21 #include <wibble/test.h> 23 #include <tagcoll/input/string.h> 30 inline static const char*
indexref(
const char* index,
int id)
32 return index + ((
int*)index)[id];
40 "Description: Taste\n\n" 42 "Description: Sweet\n\n" 44 "Description: Salty\n\n";
47 "Description: Smell\n\n" 49 "Description: Fresh\n\n" 51 "Description: Mold\n\n";
52 tagcoll::input::String in1(voc1);
53 tagcoll::input::String in2(voc2);
62 vm.
write(
"/dev/null");
73 assert_eq(
string(indexref(facetIndex, 0) + 4*
sizeof(
int)),
"smell");
74 assert_eq(
string(indexref(facetIndex, 1) + 4*
sizeof(
int)),
"taste");
77 assert_eq(((
int*)indexref(facetIndex, 0))[2], 0);
78 assert_eq(((
int*)indexref(facetIndex, 0))[3], 1);
79 assert_eq(((
int*)indexref(facetIndex, 1))[2], 2);
80 assert_eq(((
int*)indexref(facetIndex, 1))[3], 3);
83 assert_eq(
string(indexref(tagIndex, 0) + 3*
sizeof(
int)),
"smell::fresh");
84 assert_eq(
string(indexref(tagIndex, 1) + 3*
sizeof(
int)),
"smell::mold");
85 assert_eq(
string(indexref(tagIndex, 2) + 3*
sizeof(
int)),
"taste::salty");
86 assert_eq(
string(indexref(tagIndex, 3) + 3*
sizeof(
int)),
"taste::sweet");
89 assert_eq(((
int*)indexref(tagIndex, 0))[2], 0);
90 assert_eq(((
int*)indexref(tagIndex, 1))[2], 0);
91 assert_eq(((
int*)indexref(tagIndex, 2))[2], 1);
92 assert_eq(((
int*)indexref(tagIndex, 3))[2], 1);
100 "Description: Tag without facet\n" 101 " VocabularyMerged should behave fine in this case.\n\n";
102 tagcoll::input::String in(voc);
108 vm.
write(
"/dev/null");
124 "Description: Facet without tags\n" 125 " VocabularyMerged used to segfault in this case.\n\n";
126 tagcoll::input::String in(voc);
132 vm.
write(
"/dev/null");
Test _2()
Definition: vocabularymerger.test.h:96
Definition: packagerecord.test.h:22
Test _1()
Definition: vocabularymerger.test.h:36
Test _3()
Definition: vocabularymerger.test.h:120
static const char * indexref(const char *index, int id)
Definition: vocabularymerger.test.h:30
Definition: vocabularymerger.test.h:28