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

Commit50e6446

Browse files
Add GalleySeries for binary stamps; add tests for it
1 parent7be5616 commit50e6446

File tree

3 files changed

+55
-9
lines changed

3 files changed

+55
-9
lines changed

‎blobstamper/galley.cpp‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ GalleySeries::Extract(Blob &blob)
2121
return res;
2222
}
2323

24+
std::list<void *>
25+
GalleySeries::ExtractBin(Blob &blob)
26+
{
27+
std::list<void *> res;
28+
std::list<Blob> blobs =extract_internal(blob);
29+
for(Blob blob : blobs)
30+
{
31+
void * data= blob.ShiftSingleStampBin(stamp);
32+
res.push_back(data);
33+
}
34+
return res;
35+
}
36+
2437

2538
std::list<Blob>
2639
GalleySeries::extract_internal(Blob &blob)

‎blobstamper/galley.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class GalleySeries : public GalleyBase
2727
GalleySeries(StampGeneric & stamp_arg) : stamp(stamp_arg) {};
2828
std::list<Blob>extract_internal(Blob &blob);
2929
std::list<std::string>Extract(Blob &blob);
30+
std::list<void *>ExtractBin(Blob &blob);
31+
3032
intminSize()override;
3133
intmaxSize()override {return -1;};/* Sereies always takes as much data as it can take*/
3234
boolisFixedSize()override {return0;}/* And not fixed size*/

‎t/300-galley.cpp‎

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,18 @@ main()
6666
std::string str;
6767

6868
str = res.front();
69-
is(str, expected1,"GalleySeries, fixed size stamp: First element of shifted list is ok");
69+
is(str, expected1,"GalleySeries, fixed sizestringstamp: First element of shifted list is ok");
7070
res.pop_front();
7171

7272
str = res.front();
73-
is(str, expected2,"GalleySeries, fixed size stamp: Second element of shifted list is ok");
73+
is(str, expected2,"GalleySeries, fixed sizestringstamp: Second element of shifted list is ok");
7474
res.pop_front();
7575

7676
str = res.front();
77-
is(str, expected3,"GalleySeries, fixed size stamp: Third element of shifted list is ok");
77+
is(str, expected3,"GalleySeries, fixed sizestringstamp: Third element of shifted list is ok");
7878
res.pop_front();
7979

80-
ok(res.empty(),"GalleySeries, fixed size stamp: The rest of the list is empty");
80+
ok(res.empty(),"GalleySeries, fixed sizestringstamp: The rest of the list is empty");
8181
}
8282
/* Test Galley Sereies with unlimited size stampp*/
8383
{/* 5 .. 9*/
@@ -97,22 +97,53 @@ main()
9797
std::string str;
9898

9999
str = res.front();
100-
is(str, expected1,"GalleySeries, unlimited size stamp: First element of shifted list is ok");
100+
is(str, expected1,"GalleySeries, unlimited sizestringstamp: First element of shifted list is ok");
101101
res.pop_front();
102102

103103
str = res.front();
104-
is(str, expected2,"GalleySeries, unlimited size stamp: Second element of shifted list is ok");
104+
is(str, expected2,"GalleySeries, unlimited sizestringstamp: Second element of shifted list is ok");
105105
res.pop_front();
106106

107107
str = res.front();
108-
is(str, expected3,"GalleySeries, unlimited size stamp: Third element of shifted list is ok");
108+
is(str, expected3,"GalleySeries, unlimited sizestringstamp: Third element of shifted list is ok");
109109
res.pop_front();
110110

111111
str = res.front();
112-
is(str, expected4,"GalleySeries, unlimited size stamp: Fourth element of shifted list is ok");
112+
is(str, expected4,"GalleySeries, unlimited sizestringstamp: Fourth element of shifted list is ok");
113113
res.pop_front();
114114

115-
ok(res.empty(),"GalleySeries, unlimited size stamp: The rest of the list is empty");
115+
ok(res.empty(),"GalleySeries, unlimited size string stamp: The rest of the list is empty");
116+
}
117+
118+
{/* 1..4*/
119+
120+
unsignedshortint expected1 = (unsignedchar)'2' *256 +(unsignedchar)'1';
121+
unsignedshortint expected2 = (unsignedchar)'4' *256 +(unsignedchar)'3';
122+
unsignedshortint expected3 = (unsignedchar)'6' *256 +(unsignedchar)'5';
123+
124+
StampBinInt16 stamp;
125+
GalleySeriesgalley(stamp);
126+
Blobblob(short_sample,strlen(short_sample));
127+
std::list<void * > res = galley.ExtractBin(blob);
128+
129+
unsignedshortint * data;
130+
131+
data = (unsignedshortint *) res.front();
132+
is(*data, expected1,"GalleySeries, fixed size binary stamp: First element of shifted list is ok");
133+
res.pop_front();
134+
free(data);
135+
136+
data = (unsignedshortint *) res.front();
137+
is(*data, expected2,"GalleySeries, fixed size binary stamp: Second element of shifted list is ok");
138+
res.pop_front();
139+
free(data);
140+
141+
data = (unsignedshortint *) res.front();
142+
is(*data, expected3,"GalleySeries, fixed size binary stamp: Third element of shifted list is ok");
143+
res.pop_front();
144+
free(data);
145+
146+
ok(res.empty(),"GalleySeries, fixed size binary stamp: The rest of the list is empty");
116147
}
117148

118149
TEST_END;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp