Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit64279cc

Browse files
Tests for series galley when using it with variated size stamp
1 parentcbc91eb commit64279cc

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

‎t/300-galley.cpp‎

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ char longer_sample[]="z1234567*89abcde&fghijklmnopqrstuvwxyzAB%CDEFGHIJKLMNOPQRS
4949
int
5050
main()
5151
{
52-
TEST_START(13);
52+
TEST_START(18);
5353
/* Test Galley Sereies with fixed size stampp*/
5454
{/* 1..4*/
5555
std::string expected1 ="12";
@@ -77,7 +77,7 @@ main()
7777

7878
ok(res.empty(),"GalleySeries, fixed size string stamp: The rest of the list is empty");
7979
}
80-
/* Test Galley Sereies with unlimited sizestampp*/
80+
/* Test Galley Sereies with unlimited sizestamp*/
8181
{/* 5 .. 9*/
8282
/* This is not the best test, as we do not predict behavior by setting forged sample values,
8383
but at least here we check that it work the same way it worked before. May be this test should be improved later*/
@@ -144,5 +144,46 @@ main()
144144
ok(res.empty(),"GalleySeries, fixed size binary stamp: The rest of the list is empty");
145145
}
146146

147+
/* Test Galley Sereies with variated size stamp*/
148+
{/* 14 .. 18*/
149+
/* This is not the best test, as we do not predict behavior by setting forged sample values,
150+
but at least here we check that it work the same way it worked before. May be this test should be improved later*/
151+
152+
char sample[]="z1234567*89abcde&fghijklm";
153+
154+
std::string expected1 ="234";
155+
std::string expected2 ="7*8";
156+
std::string expected3 ="bcde";
157+
std::string expected4 ="ghij";
158+
159+
Blobblob(sample,strlen(sample));
160+
StampSeveralChars stamp;
161+
GalleySeriesgalley(stamp);
162+
163+
std::list<std::string> res = galley.ExtractStr(blob);
164+
std::string str;
165+
166+
str = res.front();
167+
is(str, expected1,"GalleySeries, unlimited size string stamp: First element of shifted list is ok");
168+
res.pop_front();
169+
170+
str = res.front();
171+
is(str, expected2,"GalleySeries, unlimited size string stamp: Second element of shifted list is ok");
172+
res.pop_front();
173+
174+
str = res.front();
175+
is(str, expected3,"GalleySeries, unlimited size string stamp: Third element of shifted list is ok");
176+
res.pop_front();
177+
178+
str = res.front();
179+
is(str, expected4,"GalleySeries, unlimited size string stamp: Fourth element of shifted list is ok");
180+
res.pop_front();
181+
182+
ok(res.empty(),"GalleySeries, unlimited size string stamp: The rest of the list is empty");
183+
}
184+
185+
186+
187+
147188
TEST_END;
148189
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp