mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Add more testdata/*.gz files.
This commit is contained in:
1 parent
727073ac89
commit
4efce30bfc
6 files changed
+481
No files matched your search
@@ -0,0 +1,118 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
// extract-flate-offsets.go extracts the start and end offsets of the
|
||||
// flate-compressed data wrapped in a .gz file.
|
||||
//
|
||||
// Usage: go run extract-flate-offsets.go foo.gz bar.gz
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/flate"
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
// GZIP wraps a header and footer around flate data. The format is described in
|
||||
// RFC 1952: https://www.ietf.org/rfc/rfc1952.txt
|
||||
const (
|
||||
flagText = 1 << 0
|
||||
flagHCRC = 1 << 1
|
||||
flagExtra = 1 << 2
|
||||
flagName = 1 << 3
|
||||
flagComment = 1 << 4
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := main1(); err != nil {
|
||||
os.Stderr.WriteString(err.Error() + "\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func main1() error {
|
||||
for _, a := range os.Args[1:] {
|
||||
if err := decode(a); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func decode(filename string) error {
|
||||
src, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
const (
|
||||
headerSize = 10
|
||||
footerSize = 8
|
||||
)
|
||||
if len(src) < headerSize+footerSize || src[0] != 0x1F || src[1] != 0x8B || src[2] != 0x08 {
|
||||
return fmt.Errorf("not a GZIP")
|
||||
}
|
||||
if len(src) >= 0x10000000 {
|
||||
return fmt.Errorf("file too large")
|
||||
}
|
||||
flags := src[3]
|
||||
i := headerSize
|
||||
src = src[:len(src)-footerSize]
|
||||
|
||||
if flags&flagExtra != 0 {
|
||||
return fmt.Errorf("TODO: support gzip extra flag")
|
||||
}
|
||||
|
||||
if flags&flagName != 0 {
|
||||
if i, err = readString(src, i); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if flags&flagComment != 0 {
|
||||
if i, err = readString(src, i); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if flags&flagHCRC != 0 {
|
||||
return fmt.Errorf("TODO: support gzip HCRC flag")
|
||||
}
|
||||
|
||||
// As a sanity check, the result should be valid flate.
|
||||
hash, err := checkFlate(src[i:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("%7d %7d %x %s\n", i, len(src), hash, filename)
|
||||
return nil
|
||||
}
|
||||
|
||||
func readString(src []byte, i int) (int, error) {
|
||||
for {
|
||||
if i >= len(src) {
|
||||
return 0, fmt.Errorf("bad GZIP string")
|
||||
}
|
||||
if src[i] == 0 {
|
||||
return i + 1, nil
|
||||
}
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
func checkFlate(x []byte) ([md5.Size]byte, error) {
|
||||
rc := flate.NewReader(bytes.NewReader(x))
|
||||
defer rc.Close()
|
||||
x, err := ioutil.ReadAll(rc)
|
||||
if err != nil {
|
||||
return [md5.Size]byte{}, fmt.Errorf("data is not valid flate: %v", err)
|
||||
}
|
||||
return md5.Sum(x), nil
|
||||
}
|
||||
Vendored
+6
@@ -25,8 +25,14 @@ waives any copyright it might have, for any purpose, including commercial and
|
||||
noncommercial use, free of charge and without requiring permission from the
|
||||
Museum."
|
||||
|
||||
midsummer.txt is an excerpt of Shakespeare's "A Midsummer Night's Dream",
|
||||
copied from http://shakespeare.mit.edu/midsummer/midsummer.1.1.html
|
||||
|
||||
pi.txt contains the digits of pi. The *.giflzw file was generated by
|
||||
script/compress-giflzw.go
|
||||
|
||||
pjw-thumbnail.* are various encodings of an image derived from an iconic,
|
||||
original photo of Peter J. Weinberger by Rob Pike <r@golang.org>.
|
||||
|
||||
romeo.txt is an excerpt of Shakespeare's "Romeo and Juliet", copied from
|
||||
http://shakespeare.mit.edu/romeo_juliet/romeo_juliet.2.2.html
|
||||
Vendored
+323
@@ -0,0 +1,323 @@
|
||||
A Midsummer Night's Dream
|
||||
Act 1, Scene 1
|
||||
|
||||
SCENE I. Athens. The palace of THESEUS.
|
||||
|
||||
Enter THESEUS, HIPPOLYTA, PHILOSTRATE, and Attendants
|
||||
THESEUS
|
||||
Now, fair Hippolyta, our nuptial hour
|
||||
Draws on apace; four happy days bring in
|
||||
Another moon: but, O, methinks, how slow
|
||||
This old moon wanes! she lingers my desires,
|
||||
Like to a step-dame or a dowager
|
||||
Long withering out a young man revenue.
|
||||
HIPPOLYTA
|
||||
Four days will quickly steep themselves in night;
|
||||
Four nights will quickly dream away the time;
|
||||
And then the moon, like to a silver bow
|
||||
New-bent in heaven, shall behold the night
|
||||
Of our solemnities.
|
||||
THESEUS
|
||||
Go, Philostrate,
|
||||
Stir up the Athenian youth to merriments;
|
||||
Awake the pert and nimble spirit of mirth;
|
||||
Turn melancholy forth to funerals;
|
||||
The pale companion is not for our pomp.
|
||||
Exit PHILOSTRATE
|
||||
|
||||
Hippolyta, I woo'd thee with my sword,
|
||||
And won thy love, doing thee injuries;
|
||||
But I will wed thee in another key,
|
||||
With pomp, with triumph and with revelling.
|
||||
Enter EGEUS, HERMIA, LYSANDER, and DEMETRIUS
|
||||
|
||||
EGEUS
|
||||
Happy be Theseus, our renowned duke!
|
||||
THESEUS
|
||||
Thanks, good Egeus: what's the news with thee?
|
||||
EGEUS
|
||||
Full of vexation come I, with complaint
|
||||
Against my child, my daughter Hermia.
|
||||
Stand forth, Demetrius. My noble lord,
|
||||
This man hath my consent to marry her.
|
||||
Stand forth, Lysander: and my gracious duke,
|
||||
This man hath bewitch'd the bosom of my child;
|
||||
Thou, thou, Lysander, thou hast given her rhymes,
|
||||
And interchanged love-tokens with my child:
|
||||
Thou hast by moonlight at her window sung,
|
||||
With feigning voice verses of feigning love,
|
||||
And stolen the impression of her fantasy
|
||||
With bracelets of thy hair, rings, gawds, conceits,
|
||||
Knacks, trifles, nosegays, sweetmeats, messengers
|
||||
Of strong prevailment in unharden'd youth:
|
||||
With cunning hast thou filch'd my daughter's heart,
|
||||
Turn'd her obedience, which is due to me,
|
||||
To stubborn harshness: and, my gracious duke,
|
||||
Be it so she; will not here before your grace
|
||||
Consent to marry with Demetrius,
|
||||
I beg the ancient privilege of Athens,
|
||||
As she is mine, I may dispose of her:
|
||||
Which shall be either to this gentleman
|
||||
Or to her death, according to our law
|
||||
Immediately provided in that case.
|
||||
THESEUS
|
||||
What say you, Hermia? be advised fair maid:
|
||||
To you your father should be as a god;
|
||||
One that composed your beauties, yea, and one
|
||||
To whom you are but as a form in wax
|
||||
By him imprinted and within his power
|
||||
To leave the figure or disfigure it.
|
||||
Demetrius is a worthy gentleman.
|
||||
HERMIA
|
||||
So is Lysander.
|
||||
THESEUS
|
||||
In himself he is;
|
||||
But in this kind, wanting your father's voice,
|
||||
The other must be held the worthier.
|
||||
HERMIA
|
||||
I would my father look'd but with my eyes.
|
||||
THESEUS
|
||||
Rather your eyes must with his judgment look.
|
||||
HERMIA
|
||||
I do entreat your grace to pardon me.
|
||||
I know not by what power I am made bold,
|
||||
Nor how it may concern my modesty,
|
||||
In such a presence here to plead my thoughts;
|
||||
But I beseech your grace that I may know
|
||||
The worst that may befall me in this case,
|
||||
If I refuse to wed Demetrius.
|
||||
THESEUS
|
||||
Either to die the death or to abjure
|
||||
For ever the society of men.
|
||||
Therefore, fair Hermia, question your desires;
|
||||
Know of your youth, examine well your blood,
|
||||
Whether, if you yield not to your father's choice,
|
||||
You can endure the livery of a nun,
|
||||
For aye to be in shady cloister mew'd,
|
||||
To live a barren sister all your life,
|
||||
Chanting faint hymns to the cold fruitless moon.
|
||||
Thrice-blessed they that master so their blood,
|
||||
To undergo such maiden pilgrimage;
|
||||
But earthlier happy is the rose distill'd,
|
||||
Than that which withering on the virgin thorn
|
||||
Grows, lives and dies in single blessedness.
|
||||
HERMIA
|
||||
So will I grow, so live, so die, my lord,
|
||||
Ere I will my virgin patent up
|
||||
Unto his lordship, whose unwished yoke
|
||||
My soul consents not to give sovereignty.
|
||||
THESEUS
|
||||
Take time to pause; and, by the next new moon--
|
||||
The sealing-day betwixt my love and me,
|
||||
For everlasting bond of fellowship--
|
||||
Upon that day either prepare to die
|
||||
For disobedience to your father's will,
|
||||
Or else to wed Demetrius, as he would;
|
||||
Or on Diana's altar to protest
|
||||
For aye austerity and single life.
|
||||
DEMETRIUS
|
||||
Relent, sweet Hermia: and, Lysander, yield
|
||||
Thy crazed title to my certain right.
|
||||
LYSANDER
|
||||
You have her father's love, Demetrius;
|
||||
Let me have Hermia's: do you marry him.
|
||||
EGEUS
|
||||
Scornful Lysander! true, he hath my love,
|
||||
And what is mine my love shall render him.
|
||||
And she is mine, and all my right of her
|
||||
I do estate unto Demetrius.
|
||||
LYSANDER
|
||||
I am, my lord, as well derived as he,
|
||||
As well possess'd; my love is more than his;
|
||||
My fortunes every way as fairly rank'd,
|
||||
If not with vantage, as Demetrius';
|
||||
And, which is more than all these boasts can be,
|
||||
I am beloved of beauteous Hermia:
|
||||
Why should not I then prosecute my right?
|
||||
Demetrius, I'll avouch it to his head,
|
||||
Made love to Nedar's daughter, Helena,
|
||||
And won her soul; and she, sweet lady, dotes,
|
||||
Devoutly dotes, dotes in idolatry,
|
||||
Upon this spotted and inconstant man.
|
||||
THESEUS
|
||||
I must confess that I have heard so much,
|
||||
And with Demetrius thought to have spoke thereof;
|
||||
But, being over-full of self-affairs,
|
||||
My mind did lose it. But, Demetrius, come;
|
||||
And come, Egeus; you shall go with me,
|
||||
I have some private schooling for you both.
|
||||
For you, fair Hermia, look you arm yourself
|
||||
To fit your fancies to your father's will;
|
||||
Or else the law of Athens yields you up--
|
||||
Which by no means we may extenuate--
|
||||
To death, or to a vow of single life.
|
||||
Come, my Hippolyta: what cheer, my love?
|
||||
Demetrius and Egeus, go along:
|
||||
I must employ you in some business
|
||||
Against our nuptial and confer with you
|
||||
Of something nearly that concerns yourselves.
|
||||
EGEUS
|
||||
With duty and desire we follow you.
|
||||
Exeunt all but LYSANDER and HERMIA
|
||||
|
||||
LYSANDER
|
||||
How now, my love! why is your cheek so pale?
|
||||
How chance the roses there do fade so fast?
|
||||
HERMIA
|
||||
Belike for want of rain, which I could well
|
||||
Beteem them from the tempest of my eyes.
|
||||
LYSANDER
|
||||
Ay me! for aught that I could ever read,
|
||||
Could ever hear by tale or history,
|
||||
The course of true love never did run smooth;
|
||||
But, either it was different in blood,--
|
||||
HERMIA
|
||||
O cross! too high to be enthrall'd to low.
|
||||
LYSANDER
|
||||
Or else misgraffed in respect of years,--
|
||||
HERMIA
|
||||
O spite! too old to be engaged to young.
|
||||
LYSANDER
|
||||
Or else it stood upon the choice of friends,--
|
||||
HERMIA
|
||||
O hell! to choose love by another's eyes.
|
||||
LYSANDER
|
||||
Or, if there were a sympathy in choice,
|
||||
War, death, or sickness did lay siege to it,
|
||||
Making it momentany as a sound,
|
||||
Swift as a shadow, short as any dream;
|
||||
Brief as the lightning in the collied night,
|
||||
That, in a spleen, unfolds both heaven and earth,
|
||||
And ere a man hath power to say 'Behold!'
|
||||
The jaws of darkness do devour it up:
|
||||
So quick bright things come to confusion.
|
||||
HERMIA
|
||||
If then true lovers have been ever cross'd,
|
||||
It stands as an edict in destiny:
|
||||
Then let us teach our trial patience,
|
||||
Because it is a customary cross,
|
||||
As due to love as thoughts and dreams and sighs,
|
||||
Wishes and tears, poor fancy's followers.
|
||||
LYSANDER
|
||||
A good persuasion: therefore, hear me, Hermia.
|
||||
I have a widow aunt, a dowager
|
||||
Of great revenue, and she hath no child:
|
||||
From Athens is her house remote seven leagues;
|
||||
And she respects me as her only son.
|
||||
There, gentle Hermia, may I marry thee;
|
||||
And to that place the sharp Athenian law
|
||||
Cannot pursue us. If thou lovest me then,
|
||||
Steal forth thy father's house to-morrow night;
|
||||
And in the wood, a league without the town,
|
||||
Where I did meet thee once with Helena,
|
||||
To do observance to a morn of May,
|
||||
There will I stay for thee.
|
||||
HERMIA
|
||||
My good Lysander!
|
||||
I swear to thee, by Cupid's strongest bow,
|
||||
By his best arrow with the golden head,
|
||||
By the simplicity of Venus' doves,
|
||||
By that which knitteth souls and prospers loves,
|
||||
And by that fire which burn'd the Carthage queen,
|
||||
When the false Troyan under sail was seen,
|
||||
By all the vows that ever men have broke,
|
||||
In number more than ever women spoke,
|
||||
In that same place thou hast appointed me,
|
||||
To-morrow truly will I meet with thee.
|
||||
LYSANDER
|
||||
Keep promise, love. Look, here comes Helena.
|
||||
Enter HELENA
|
||||
|
||||
HERMIA
|
||||
God speed fair Helena! whither away?
|
||||
HELENA
|
||||
Call you me fair? that fair again unsay.
|
||||
Demetrius loves your fair: O happy fair!
|
||||
Your eyes are lode-stars; and your tongue's sweet air
|
||||
More tuneable than lark to shepherd's ear,
|
||||
When wheat is green, when hawthorn buds appear.
|
||||
Sickness is catching: O, were favour so,
|
||||
Yours would I catch, fair Hermia, ere I go;
|
||||
My ear should catch your voice, my eye your eye,
|
||||
My tongue should catch your tongue's sweet melody.
|
||||
Were the world mine, Demetrius being bated,
|
||||
The rest I'd give to be to you translated.
|
||||
O, teach me how you look, and with what art
|
||||
You sway the motion of Demetrius' heart.
|
||||
HERMIA
|
||||
I frown upon him, yet he loves me still.
|
||||
HELENA
|
||||
O that your frowns would teach my smiles such skill!
|
||||
HERMIA
|
||||
I give him curses, yet he gives me love.
|
||||
HELENA
|
||||
O that my prayers could such affection move!
|
||||
HERMIA
|
||||
The more I hate, the more he follows me.
|
||||
HELENA
|
||||
The more I love, the more he hateth me.
|
||||
HERMIA
|
||||
His folly, Helena, is no fault of mine.
|
||||
HELENA
|
||||
None, but your beauty: would that fault were mine!
|
||||
HERMIA
|
||||
Take comfort: he no more shall see my face;
|
||||
Lysander and myself will fly this place.
|
||||
Before the time I did Lysander see,
|
||||
Seem'd Athens as a paradise to me:
|
||||
O, then, what graces in my love do dwell,
|
||||
That he hath turn'd a heaven unto a hell!
|
||||
LYSANDER
|
||||
Helen, to you our minds we will unfold:
|
||||
To-morrow night, when Phoebe doth behold
|
||||
Her silver visage in the watery glass,
|
||||
Decking with liquid pearl the bladed grass,
|
||||
A time that lovers' flights doth still conceal,
|
||||
Through Athens' gates have we devised to steal.
|
||||
HERMIA
|
||||
And in the wood, where often you and I
|
||||
Upon faint primrose-beds were wont to lie,
|
||||
Emptying our bosoms of their counsel sweet,
|
||||
There my Lysander and myself shall meet;
|
||||
And thence from Athens turn away our eyes,
|
||||
To seek new friends and stranger companies.
|
||||
Farewell, sweet playfellow: pray thou for us;
|
||||
And good luck grant thee thy Demetrius!
|
||||
Keep word, Lysander: we must starve our sight
|
||||
From lovers' food till morrow deep midnight.
|
||||
LYSANDER
|
||||
I will, my Hermia.
|
||||
Exit HERMIA
|
||||
|
||||
Helena, adieu:
|
||||
As you on him, Demetrius dote on you!
|
||||
Exit
|
||||
|
||||
HELENA
|
||||
How happy some o'er other some can be!
|
||||
Through Athens I am thought as fair as she.
|
||||
But what of that? Demetrius thinks not so;
|
||||
He will not know what all but he do know:
|
||||
And as he errs, doting on Hermia's eyes,
|
||||
So I, admiring of his qualities:
|
||||
Things base and vile, folding no quantity,
|
||||
Love can transpose to form and dignity:
|
||||
Love looks not with the eyes, but with the mind;
|
||||
And therefore is wing'd Cupid painted blind:
|
||||
Nor hath Love's mind of any judgement taste;
|
||||
Wings and no eyes figure unheedy haste:
|
||||
And therefore is Love said to be a child,
|
||||
Because in choice he is so oft beguiled.
|
||||
As waggish boys in game themselves forswear,
|
||||
So the boy Love is perjured every where:
|
||||
For ere Demetrius look'd on Hermia's eyne,
|
||||
He hail'd down oaths that he was only mine;
|
||||
And when this hail some heat from Hermia felt,
|
||||
So he dissolved, and showers of oaths did melt.
|
||||
I will go tell him of fair Hermia's flight:
|
||||
Then to the wood will he to-morrow night
|
||||
Pursue her; and for this intelligence
|
||||
If I have thanks, it is a dear expense:
|
||||
But herein mean I to enrich my pain,
|
||||
To have his sight thither and back again.
|
||||
Exit
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
Romeo and Juliet
|
||||
Excerpt from Act 2, Scene 2
|
||||
|
||||
JULIET
|
||||
O Romeo, Romeo! wherefore art thou Romeo?
|
||||
Deny thy father and refuse thy name;
|
||||
Or, if thou wilt not, be but sworn my love,
|
||||
And I'll no longer be a Capulet.
|
||||
|
||||
ROMEO
|
||||
[Aside] Shall I hear more, or shall I speak at this?
|
||||
|
||||
JULIET
|
||||
'Tis but thy name that is my enemy;
|
||||
Thou art thyself, though not a Montague.
|
||||
What's Montague? it is nor hand, nor foot,
|
||||
Nor arm, nor face, nor any other part
|
||||
Belonging to a man. O, be some other name!
|
||||
What's in a name? that which we call a rose
|
||||
By any other name would smell as sweet;
|
||||
So Romeo would, were he not Romeo call'd,
|
||||
Retain that dear perfection which he owes
|
||||
Without that title. Romeo, doff thy name,
|
||||
And for that name which is no part of thee
|
||||
Take all myself.
|
||||
|
||||
ROMEO
|
||||
I take thee at thy word:
|
||||
Call me but love, and I'll be new baptized;
|
||||
Henceforth I never will be Romeo.
|
||||
|
||||
JULIET
|
||||
What man art thou that thus bescreen'd in night
|
||||
So stumblest on my counsel?
|
||||
Vendored
BIN
Binary file not shown.
Reference in new issue
Block a user