Skip to content

Commit e099be4

Browse files
committed
add functional test
1 parent 6a0defe commit e099be4

File tree

6 files changed

+222
-6
lines changed

6 files changed

+222
-6
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ target
55
*.1
66
*.1.gz
77
.vscode/
8-
test/output
8+
tests/functional/output

01-test

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
#!/bin/sh
22

3+
# Unit testing
4+
35
cargo test \
46
&& echo Cargo test succeeded. \
57
|| ( echo Cargo test failed. && exit 1 )
68

79

8-
cd ./test
10+
# Functional tests
11+
12+
cd ./tests/functional/
13+
14+
cargo build
15+
916
# We search for `?`.
10-
../target/debug/stringsext -q 16 -g 63 -tx -a All-Ctrl -u Common -e UTF-8 -e utf-16le -e utf-16be input > output
17+
../../target/debug/stringsext -q 16 -g 63 -tx -a All-Ctrl -u Common \
18+
-e UTF-8 -e utf-16le -e utf-16be input1 > output
19+
20+
diff output expected_output1 \
21+
&& echo Commandline test 1 succeeded. \
22+
|| ( echo Commandline test 1 failed. && exit 2 )
23+
24+
# We search for `:`.
25+
../../target/debug/stringsext -n 10 -q 32 -g 58 -tx -a All-Ctrl -u Common \
26+
-e UTF-8 -e utf-16le -e utf-16be input1 input2 > output
1127

12-
diff output expected_output \
13-
&& echo Commandline test succeeded. \
14-
|| echo Commandline test failed.
28+
diff output expected_output2 \
29+
&& echo Commandline test 2 succeeded. \
30+
|| ( echo Commandline test 2 failed. && exit 3 )

tests/functional/expected_output2

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+

2+
A 500 (a UTF-8) A Gathering: Chicago
3+
A <540 (a UTF-8) Who Moved My Cheese?: The Story
4+
A <580 (a UTF-8) The Mice: Sniff & Scurry
5+
A >580 (a UTF-8) The Little people: Hem & Haw
6+
A <640 (a UTF-8) A Discussion: Later That Same Da
7+
A >640+ (a UTF-8) y
8+
A <700 (a UTF-8) the mice: "Sniff" and "Scurry;'
9+
A >700+ (a UTF-8) and
10+
A >700 (a UTF-8) the Little people: "Hem" and "Ha
11+
A >700+ (a UTF-8) w"
12+
A 900 (a UTF-8) hing in common:
13+
A 1a80 (a UTF-8) common: every morning, they each
14+
A >1a80+ (a UTF-8) pu
15+
A 1ac0+ (a UTF-8) t on their jogging suits and run
16+
A >1ac0+ (a UTF-8) ning
17+
A 27c0 (a UTF-8) them smile. One read:
18+
A 2ec0 (a UTF-8) Who Moved My Cheese? The Movie:
19+
A 2fc0 (a UTF-8) Aft A-Mawng Change Profile:
20+
A 3200 (a UTF-8) To learn more, visit:
21+
B <10272 (b UTF-16LE) input device path: "%s"
22+
B <102b2 (b UTF-16LE) sub-path (%hhd,%hhd): "%s"
23+
B <10332 (b UTF-16LE) Could not get file info: %r
24+
B <10372 (b UTF-16LE) Couldn't open "%s": %r
25+
B <104b2 (b UTF-16LE) Could not create variable: %r
26+
B 10572 (b UTF-16LE) nbootorder: %d
27+
B <105b2 (b UTF-16LE) BootOrder:
28+
B >105b2 (b UTF-16LE) file DP: %s
29+
B 105f2 (b UTF-16LE) device path: "%s"
30+
B <10632 (b UTF-16LE) CSV data: "%s"
31+
B >10632 (b UTF-16LE) filename: "%s"
32+
B <10672 (b UTF-16LE) label: "%s"
33+
B >10672 (b UTF-16LE) arguments: "%s"
34+
B <106f2 (b UTF-16LE) Could not read file "%s": %r
35+
B <10732 (b UTF-16LE) File looks like:
36+
B 107b2 (b UTF-16LE) t get info for "%s": %r
37+
B <107f2 (b UTF-16LE) Could not read \EFI\%s\: %r
38+
B <10872 (b UTF-16LE) Couldn't open \EFI\%s\%s: %r
39+
B <108b2 (b UTF-16LE) Could not process \EFI\%s\%s: %r
40+
B <108f2 (b UTF-16LE) Couldn't find file system: %r
41+
B <10932 (b UTF-16LE) Couldn't open file system: %r
42+
B <10972 (b UTF-16LE) Couldn't open EFI: %r
43+
B <109b2 (b UTF-16LE) Couldn't set file position: %r
44+
B <109f2 (b UTF-16LE) Could not read \EFI\: %r
45+
B <10a72 (b UTF-16LE) %d Couldn't open %s: %r
46+
B <10ab2 (b UTF-16LE) LoadImage failed: %r
47+
B >10ab2 (b UTF-16LE) Device path: "%s"
48+
B <10af2 (b UTF-16LE) StartImage failed: %r
49+
B 10bf2 (b UTF-16LE) find loaded image: %r
50+
B <10cb2 (b UTF-16LE) Error: could not find boot optio
51+
B >10cb2+ (b UTF-16LE) ns: %r
52+
B <10ef2 (b UTF-16LE) TPM logging failed: %r
53+
B 10fb2 (b UTF-16LE) w%a:%d %a()
54+
B <11072 (b UTF-16LE) Failed to read the keystroke: %r
55+
B 110b2+ (b UTF-16LE) OK
56+
B <11472 (b UTF-16LE) %s: (0x%x) %s
57+
B <114b2 (b UTF-16LE) SSL Error: %a:%d %a(): %r
58+
B 117b2 (b UTF-16LE) x:%x:%x:%x:%x:%x:%x
59+
B <11fb2 (b UTF-16LE) %02d/%02d/%02d %02d:%02d%c
60+
B 12132 (b UTF-16LE) %*a%X: %-.48a *%a*
61+
B <12172 (b UTF-16LE) Press Enter to continue :
62+
B 125f2 (a UTF-8) %lu:%s:%s:%d:%s
63+
B 12632 (a UTF-8) assertion failed: *(unsigned int
64+
B >12632+ (a UTF-8) *)lock == 1
65+
B <12832 (a UTF-8) assertion failed: *sbuffer != NU
66+
B >12832+ (a UTF-8) LL || bu
67+
B 12872+ (a UTF-8) ffer != NULL
68+
B >12872 (a UTF-8) assertion failed: *currlen <= *m
69+
B >12872+ (a UTF-8) axlen
70+
B <128b2 (a UTF-8) assertion failed: *sbuffer != NU
71+
B >128b2+ (a UTF-8) LL
72+
B >128b2 (a UTF-8) %s:%d: OpenSSL internal error: %
73+
B 128f2+ (a UTF-8) s
74+
B >128f2 (a UTF-8) error:%08lX:%s:%s:%s
75+
B <1d7f2 (a UTF-8) assertion failed: ctx->digest->m
76+
B >1d7f2+ (a UTF-8) d_size <= EVP_MAX_MD_SIZE
77+
B <1d832 (a UTF-8) assertion failed: l <= sizeof(c-
78+
B 1d872+ (a UTF-8) >iv)
79+
B >1d872 (a UTF-8) assertion failed: j <= sizeof(c-
80+
B >1d872+ (a UTF-8) >iv)
81+
B 1d8b2 (a UTF-8) assertion failed: EVP_CIPHER_key
82+
B >1d8b2+ (a UTF-8) _length(cipher) <= (int)
83+
B 1d8f2+ (a UTF-8) sizeof(md_tmp)
84+
B >1d8f2 (a UTF-8) assertion failed: EVP_CIPHER_iv_
85+
B >1d8f2+ (a UTF-8) length(cipher) <
86+
B 1d932+ (a UTF-8) = 16
87+
B >1d932 (a UTF-8) assertion failed: keylen <= size
88+
B >1d932+ (a UTF-8) of key
89+
B 1d972 (a UTF-8) assertion failed: j <= (int)size
90+
B >1d972+ (a UTF-8) of(ctx->
91+
B 1d9b2+ (a UTF-8) key)
92+
B <1d9f2 (a UTF-8) assertion failed: chunk >= 0
93+
B <1deb2 (a UTF-8) assertion failed: i != 0
94+
B <1e0f2 (a UTF-8) :BAD OBJECT
95+
B >1e0f2 (a UTF-8) :BAD BOOLEAN
96+
B >1e0f2 (a UTF-8) [HEX DUMP]:
97+
B <1e132 (a UTF-8) :BAD INTEGER
98+
B >1e132 (a UTF-8) :BAD ENUMERATED
99+
B 1e7f2 (a UTF-8) assertion failed: vv == NULL
100+
B <1ecf2 (a UTF-8) assertion failed: ctx->cipher->b
101+
B >1ecf2+ (a UTF-8) lock_size == 1 || ctx->cipher->b
102+
B >1ecf2+ (a UTF-8) lock_size == 8 |
103+
B 1ed32+ (a UTF-8) | ctx->cipher->block_size == 16
104+
B >1ed32 (a UTF-8) assertion failed: EVP_CIPHER_CTX
105+
B 1ed72+ (a UTF-8) _iv_length(ctx) <= (int)sizeof(c
106+
B >1ed72+ (a UTF-8) tx->iv)
107+
B 1edb2 (a UTF-8) assertion failed: bl <= (int)siz
108+
B >1edb2+ (a UTF-8) eof(ctx->buf)
109+
B <1edf2 (a UTF-8) assertion failed: b <= sizeof ct
110+
B >1edf2+ (a UTF-8) x->buf
111+
B >1edf2 (a UTF-8) assertion failed: b <= sizeof ct
112+
B >1edf2+ (a UTF-8) x->final
113+
B 1f232 (a UTF-8) assertion failed: num == 1 && ct
114+
B >1f232+ (a UTF-8) x->num_untrusted == num
115+
B <1f272 (a UTF-8) assertion failed: num > i && i >
116+
B >1f272+ (a UTF-8) 0 && ss == 0
117+
B <1f2b2 (a UTF-8) assertion failed: ctx->num_untru
118+
B >1f2b2+ (a UTF-8) sted <= num
119+
B >1f2b2 (a UTF-8) assertion failed: num == ctx->nu
120+
B >1f2b2+ (a UTF-8) m_untrus
121+
B 1f2f2+ (a UTF-8) ted
122+
B <1f5f2 (a UTF-8) assertion failed: pp == NULL ||
123+
B >1f5f2+ (a UTF-8) *pp != NULL
124+
B <1f772 (a UTF-8) %*sPolicy:
125+
B >1f772 (a UTF-8) %*sCPS: %s
126+
B >1f772 (a UTF-8) %*sUser Notice:
127+
B <1f7b2 (a UTF-8) %*sUnknown Qualifier:
128+
B >1f7b2 (a UTF-8) %*sOrganization: %s
129+
B >1f7b2 (a UTF-8) %*sNumber%s:
130+
B <1f7f2 (a UTF-8) %*sExplicit Text: %s
131+
B <1fa32 (a UTF-8) %*sFull Name:
132+
B <1fa72 (a UTF-8) %*sRelative Name:
133+
B 1faf2 (a UTF-8) %*sCRL Issuer:
134+
B <1fd72 (a UTF-8) IP Address:<invalid>
135+
B <1fdb2 (a UTF-8) %*sPath Length Constraint:
136+
B >1fdb2 (a UTF-8) %*sPolicy Language:
137+
B <1fdf2 (a UTF-8) %*sPolicy Text: %s
138+
B <1ff32 (a UTF-8) Not Before:
139+
B >1ff32 (a UTF-8) Not After:
140+
B <200f2 (a UTF-8) %*sVersion: %ld (0x%lX)
141+
B <20132 (a UTF-8) %*sZone: %s, User:
142+
B <201f2 (a UTF-8) %s %2d %02d:%02d:%02d%.*s %d%s
143+
B <202b2 (a UTF-8) '()+,-./:=?
144+
B <206f2 (a UTF-8) %s %2d %02d:%02d:%02d %d%s
145+
B <20a32 (a UTF-8) :EXTERNAL TYPE %s
146+
B <20a72 (a UTF-8) ERROR: selector [%d] invalid
147+
B <21fb2 (a UTF-8) :':+:1:K:Q:[:c:g:m:y:
148+
B <229b2 (a UTF-8) assertion failed: bits > prime_m
149+
B >229b2+ (a UTF-8) ultiplier_bits
150+
B <22a32 (a UTF-8) %s: (%d bit)
151+
B >22a32 (a UTF-8) private-key:
152+
B >22a32 (a UTF-8) public-key:
153+
B >22a32 (a UTF-8) generator:
154+
B >22a32 (a UTF-8) subgroup order:
155+
B <22a72 (a UTF-8) subgroup factor:
156+
B <22ab2 (a UTF-8) recommended-private-length: %d b
157+
B >22ab2+ (a UTF-8) its
158+
B 22bb2 (a UTF-8) Content-Type: application/ocsp-r
159+
B >22bb2+ (a UTF-8) equest
160+
B >22bb2 (a UTF-8) Content-Length: %d
161+
B 22bf2 (a UTF-8) %*scrlUrl:
162+
B >22bf2 (a UTF-8) %*scrlNum:
163+
B >22bf2 (a UTF-8) %*scrlTime:
164+
B <22c32 (a UTF-8) %*sIssuer:
165+
B >22c32 (a UTF-8) Private-Key: (%d bit)
166+
B <22c72 (a UTF-8) publicExponent:
167+
B >22c72 (a UTF-8) Public-Key: (%d bit)
168+
B >22c72 (a UTF-8) privateExponent:
169+
B <22cb2 (a UTF-8) exponent1:
170+
B >22cb2 (a UTF-8) exponent2:
171+
B >22cb2 (a UTF-8) coefficient:
172+
B <22cf2 (a UTF-8) Hash Algorithm:
173+
B >22cf2 (a UTF-8) Mask Algorithm:
174+
B <22d32 (a UTF-8) Salt Length: 0x
175+
B <22d72 (a UTF-8) Trailer Field: 0x
176+
B <22e32 (a UTF-8) Certificate:
177+
B <22e72 (a UTF-8) %8sVersion: %ld (0x%lx)
178+
B >22e72 (a UTF-8) %8sVersion: Unknown (%ld)
179+
B >22e72 (a UTF-8) Serial Number:
180+
B <22eb2 (a UTF-8) Issuer:%c
181+
B 22ef2 (a UTF-8) Not Before:
182+
B <22f32 (a UTF-8) Not After :
183+
B >22f32 (a UTF-8) Subject:%c
184+
B >22f32 (a UTF-8) Subject Public Key Info:
185+
B <22f72 (a UTF-8) %12sPublic Key Algorithm:
186+
B <22fb2 (a UTF-8) %8sIssuer Unique ID:
187+
B >22fb2 (a UTF-8) %8sSubject Unique ID:
188+
B <22ff2 (a UTF-8) Subject OCSP hash:
189+
B >22ff2 (a UTF-8) Public key OCSP hash:
190+
B <23032 (a UTF-8) Signature Algorithm:
191+
B >23032 (a UTF-8) %*sTrusted Uses:
192+
B <23072 (a UTF-8) %*sRejected Uses:
193+
B <230b2 (a UTF-8) %*sAlias: %s
194+
B >230b2 (a UTF-8) %*sKey Id:
195+
B <231f2 (a UTF-8) othername:<unsupported>
196+
B >231f2 (a UTF-8) X400Name:<unsupported>
197+
B <23232 (a UTF-8) EdiPartyName:<unsupported>
198+
B >23232 (a UTF-8) IP Address:%d.%d.%d.%d
199+
B <23272 (a UTF-8) IP Address:<invalid>
200+
B >23272 (a UTF-8) Registered ID:
File renamed without changes.

tests/functional/input2

150 KB
Binary file not shown.

0 commit comments

Comments
 (0)