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

Commit4aeeedd

Browse files
author
Nikolay Shaplov
committed
Move tests of atomic data type stamps to ./t dir
1 parent0e5b60d commit4aeeedd

File tree

3 files changed

+56
-15
lines changed

3 files changed

+56
-15
lines changed

‎t/110-stamp-atomic.cpp‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#include<string.h>
2+
3+
#include<exception>
4+
#include<string>
5+
#include<cstdlib>
6+
7+
#defineWANT_TEST_EXTRAS
8+
#include<tap++/tap++.h>
9+
10+
#include"blobstamper/blobstamper.h"
11+
#include"blobstamper/helpers.h"
12+
13+
14+
usingnamespaceTAP;
15+
16+
17+
/* Tests for atomic type stamps*/
18+
19+
20+
21+
double sample_data[] = {1.4142,2,3.1415,4.2e01,5,6,7};
22+
23+
char my_data[]="1234567890ABCDEFGHIGKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyzАБВГДитд.___";
24+
25+
char short_sample[]="1234567";
26+
27+
int
28+
main()
29+
{
30+
char * char_sample_data = (char *) sample_data;
31+
size_t sample_data_size =sizeof(double) *7;
32+
33+
TEST_START(2);
34+
35+
/* Check that Bin Double stamp works well*/
36+
{/* 1*/
37+
double * d;
38+
Blobblob(char_sample_data, sample_data_size);
39+
StampBinDouble stamp;
40+
d = (double *) blob.ShiftSingleStampBin(stamp);
41+
ok(*d ==1.4142,"Bin Double stamp works well");
42+
free(d);
43+
}
44+
45+
/* Check that Str Double stamp works well*/
46+
{/* 1*/
47+
Blobblob(char_sample_data, sample_data_size);
48+
StampStrDouble stamp;
49+
std::string res = blob.ShiftSingleStampStr(stamp);
50+
res = blob.ShiftSingleStampStr(stamp);
51+
ok(res =="2","Str Double stamp works well");
52+
}
53+
TEST_END;
54+
}

‎t/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ DEBUG := -ggdb3 -DDEBUG
66
CXXFLAGS :=$(DEBUG)$(WARNINGS) -fPIC
77
PREFIX := /usr/local
88
LIBRARY_VAR := LD_LIBRARY_PATH
9-
TEST_GOALS := ./00-sanity.t ./001-blob-generic.t ./100-stamp-base.t
9+
TEST_GOALS := ./00-sanity.t ./001-blob-generic.t ./100-stamp-base.t ./110-stamp-atomic.t
1010

1111
all:$(TEST_GOALS)
1212

‎test_libblobstamper.cpp‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,9 @@ main(void)
1111
{
1212
Blobbl(my_data,strlen(my_data));
1313

14-
StampBinDouble stmp_double;
15-
16-
void* res = bl.ShiftSingleStampBin(stmp_double);
17-
18-
hexdump(res,sizeof(double));
19-
free(res);
20-
21-
StampStrDouble stmp_str_double;
22-
23-
std::string str = bl.ShiftSingleStampStr(stmp_str_double);
24-
25-
printf("-------- %s\n", str.c_str());
26-
2714
StampStrPgPoint stmp_pg_point;
2815

29-
str = bl.ShiftSingleStampStr(stmp_pg_point);
16+
std::stringstr = bl.ShiftSingleStampStr(stmp_pg_point);
3017

3118
printf("======= %s\n", str.c_str());
3219

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp