40 if (c==
' ' || c ==
'_') {
43 else if (isalnum(c) || strchr(additional, c)) {
57 char *dest = ARB_alloc<char>(len);
58 memcpy(dest, source, len);
75 for (
int i = 0; i<len; ++i) {
77 bool validChar = isalnum(c) || c ==
'_';
79 return GBS_global_string(
"Invalid character '%c' in '%s'; allowed: a-z A-Z 0-9 '_' ", c, key);
89 return check_key(key, key ? strlen(key) : 0);
98 if (key && key[0] ==
'/') ++key;
101 while (!err && key[0]) {
102 int nonSlashPart = strcspn(key,
"/");
143 int len = strlen(str);
144 char *
buffer = ARB_alloc<char>(2*len+1);
148 gb_assert(strlen(chars_to_escape) <= 26);
149 gb_assert(!strchr(chars_to_escape, escape_char));
151 for (i = 0; str[i]; ++i) {
152 if (str[i] == escape_char) {
153 buffer[j++] = escape_char;
154 buffer[j++] = escape_char;
157 const char *found = strchr(chars_to_escape, str[i]);
159 buffer[j++] = escape_char;
160 buffer[j++] = (found-chars_to_escape+
'A');
166 buffer[j++] = str[i];
178 int len = strlen(str);
179 char *
buffer = ARB_alloc<char>(len+1);
183 #if defined(ASSERTION_USED)
184 int escaped_chars_len = strlen(escaped_chars);
185 #endif // ASSERTION_USED
188 gb_assert(!strchr(escaped_chars, escape_char));
190 for (i = 0; str[i]; ++i) {
191 if (str[i] == escape_char) {
192 if (str[i+1] == escape_char) {
193 buffer[j++] = escape_char;
196 int idx = str[i+1]-
'A';
198 gb_assert(idx >= 0 && idx<escaped_chars_len);
199 buffer[j++] = escaped_chars[idx];
204 buffer[j++] = str[i];
227 if (len) out.
ncat(p, len);
230 if (genv) out.
cat(genv);
251 long seqlen = strlen(seq);
253 for (i = 0; i < seqlen; i++) {
255 check += count * toupper(seq[i]);
256 if (count == 57) count = 0;
265 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
266 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
267 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
268 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
269 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
270 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
271 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
272 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
273 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
274 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
275 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
276 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
277 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
278 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
279 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
280 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
281 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
282 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
283 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
284 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
285 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
286 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
287 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
288 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
289 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
290 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
291 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
292 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
293 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
294 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
295 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
296 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
297 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
298 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
299 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
300 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
301 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
302 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
303 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
304 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
305 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
306 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
307 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
308 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
309 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
310 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
311 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
312 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
313 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
314 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
315 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
324 unsigned long c = 0xffffffffL;
329 for (i=0; i<256; i++) {
330 tab[i] = ignore_case ? toupper(i) : i;
335 int k = *(
unsigned char *)exclude++;
338 if (ignore_case) tab[toupper(k)] = tab[tolower(k)] = 0;
343 i = tab[*(
const unsigned char *)seq++];
345 c =
crctab[((
int) c ^ i) & 0xff] ^ (c >> 8);
354 return GB_checksum(seq, strlen(seq), ignore_case, exclude);
364 size_t orgLen = strlen(data);
366 char *dataStart = data;
378 dest += sprintf(dest,
"%c{%zu}", last, repeat);
382 for (r = 0; r<repeat; r++) *dest++ = last;
395 return dest-dataStart;
408 TextRef(
const char *data_,
int length_) : data(data_), length(length_) {}
409 explicit TextRef(
const char *zeroTerminated) : data(zeroTerminated), length(strlen(data)) {}
411 bool defined()
const {
return data && length>0; }
444 for (
int s = 0;
s<length; ++
s) {
445 if (!isspace(data[
s])) {
446 return TextRef(data+s, length-s);
454 for (
int s = length-1;
s>=0; --
s) {
455 if (!isspace(data[
s])) {
482 if (behind_d1 && d2 && behind_d1<d2) {
483 return TextRef(behind_d1, d2-behind_d1);
503 void findBrackets(
const char *in) {
505 const char *tag_start = strchr(in,
'[');
507 const char *tag_end = strchr(tag_start,
']');
509 if (tag_end == tag_start+1) {
510 findBrackets(tag_end+1);
513 const char *unwanted_bracket =
reinterpret_cast<const char*
>(memchr(tag_start+1,
'[', tag_end-tag_start-1));
514 if (unwanted_bracket) {
515 findBrackets(unwanted_bracket);
520 nextBrackets =
TextRef(tag_start, tag_end-tag_start+1);
523 findBrackets(tag_end+1);
531 void parse_next_multi_tag() {
534 if (comma.defined()) {
545 parse_next_multi_tag();
547 else if (nextBrackets.
defined()) {
548 TextRef brackets = nextBrackets;
559 parse_next_multi_tag();
568 findBrackets(wholeInput.
get_data());
569 content = (nextBrackets.
defined() ? wholeInput.
partBefore(nextBrackets) : wholeInput).trimmed();
570 if (!content.defined()) parse_next();
591 if (!value[0])
return;
595 p = value;
while ((p = strchr(p,
'['))) *p =
'{';
596 p = value;
while ((p = strchr(p,
']'))) *p =
'}';
669 GB_HASH *g_bs_collect_tags_hash = (
GB_HASH*)cd_g_bs_collect_tags_hash;
678 char *lk =
const_cast<char*
>(strrchr(tag,
','));
682 if (!merge_result.
empty()) merge_result.
put(
' ');
684 merge_result.
put(
' ');
686 merge_result.
cat((
char*)value);
710 char *
GBS_merge_tagged_strings(
const char *s1,
const char *tag1,
const char *replace1,
const char *s2,
const char *tag2,
const char *replace2) {
726 if (!s1[0]) replace2 =
NULp;
727 if (!s2[0]) replace1 =
NULp;
729 if (replace1 && !replace1[0]) replace1 =
NULp;
730 if (replace2 && !replace2[0]) replace2 =
NULp;
778 if (buf && tagi && tagi[0]) {
782 char *contentFound =
NULp;
784 while (parser.
has_part() && !contentFound) {
808 unsigned char *strng = (
unsigned char *)strngi;
813 while ((c = *strng++)) {
824 putc(c+(
'0'-25), out);
831 else if (c ==
'\\') {
849 #pragma GCC diagnostic push
850 #pragma GCC diagnostic ignored "-Wunused-function"
856 while ((x = getc(in)) !=
'"')
if (x == EOF)
break;
859 while ((x = getc(in)) !=
'"') {
864 if (x ==
'n') { buf.
put(
'\n');
continue; }
865 if (x ==
't') { buf.
put(
'\t');
continue; }
866 if (x>=
'@' && x <=
'@' + 25) { buf.
put(x-
'@');
continue; }
867 if (x>=
'0' && x <=
'9') { buf.
put(x-(
'0'-25));
continue; }
876 #pragma GCC diagnostic pop
893 while ((x = *f++) !=
'"') {
908 if (x>=
'@' && x <=
'@' + 25) {
912 if (x>=
'0' && x <=
'9') {
929 int tlen = strlen(text);
934 while ((c=*(text++))) {
936 int ntab = (tabpos + 8) & 0xfffff8;
937 while (tabpos < ntab) {
954 const char *whitespace =
" \t\n";
955 while (str[0] && strchr(whitespace, str[0])) str++;
957 const char *end = strchr(str, 0)-1;
958 while (end >= str && strchr(whitespace, end[0])) end--;
967 if (time(&date) != -1) {
968 char *dstr = ctime(&date);
969 char *
nl = strchr(dstr,
'\n');
989 size_t clen = comment ? strlen(comment) : 0;
990 size_t alen = strlen(action);
992 GBS_strstruct new_comment(clen+1+(stamp ? 100 : 0)+alen+1+1);
995 new_comment.
cat(comment);
996 if (clen == 0 || comment[clen-1] !=
'\n') new_comment.
put(
'\n');
1001 new_comment.
cat(dated_action);
1005 new_comment.
cat(action);
1007 if (alen == 0 || action[alen-1] !=
'\n') new_comment.
put(
'\n');
1014 char **funNames = backtrace_symbols(&funptr, 1);
1015 const char *readable_fun = funNames[0];
1020 readable_fun += strlen(ARBHOME)+1;
1023 return readable_fun;
1034 #ifdef ENABLE_CRASH_TESTS
1035 static void provokesegv() {
raise(SIGSEGV); }
1036 static void dont_provokesegv() {}
1037 # if defined(ASSERTION_USED)
1038 static void failassertion() {
gb_assert(0); }
1039 # if defined(TEST_TEST_MACROS)
1040 static void dont_failassertion() {}
1042 static void provokesegv_does_not_fail_assertion() {
1050 void TEST_signal_tests__crashtest() {
1068 #if defined(TEST_TEST_MACROS)
1073 #if defined(ASSERTION_USED)
1083 #define TEST_SHORTENED_EQUALS(Long,Short) do { \
1084 char *buf = ARB_strdup(Long); \
1085 GBS_shorten_repeated_data(buf); \
1086 TEST_EXPECT_EQUAL(buf, Short); \
1090 void TEST_GBS_shorten_repeated_data() {
1091 TEST_SHORTENED_EQUALS(
"12345",
"12345");
1092 TEST_SHORTENED_EQUALS(
"aaaaaaaaaaaabc",
"a{12}bc");
1093 TEST_SHORTENED_EQUALS(
"aaaaaaaaaaabc",
"a{11}bc");
1094 TEST_SHORTENED_EQUALS(
"aaaaaaaaaabc",
"a{10}bc");
1095 TEST_SHORTENED_EQUALS(
"aaaaaaaaabc",
"a{9}bc");
1096 TEST_SHORTENED_EQUALS(
"aaaaaaaabc",
"a{8}bc");
1097 TEST_SHORTENED_EQUALS(
"aaaaaaabc",
"a{7}bc");
1098 TEST_SHORTENED_EQUALS(
"aaaaaabc",
"a{6}bc");
1099 TEST_SHORTENED_EQUALS(
"aaaaabc",
"a{5}bc");
1100 TEST_SHORTENED_EQUALS(
"aaaabc",
"aaaabc");
1101 TEST_SHORTENED_EQUALS(
"aaabc",
"aaabc");
1102 TEST_SHORTENED_EQUALS(
"aabc",
"aabc");
1103 TEST_SHORTENED_EQUALS(
"",
"");
1106 static const char *hkey_format[] = {
1112 inline const char *useInHkey(
const char *
fragment,
size_t pos) {
1116 #define TEST_IN_HKEYS_USING_EXPECT_NO_ERROR(use) do { \
1117 for (size_t i = 0; i<ARRAY_ELEMS(hkey_format); ++i) { \
1118 const char *hkey = useInHkey(use, i); \
1119 TEST_ANNOTATE(hkey); \
1120 TEST_EXPECT_NO_ERROR(GB_check_hkey(hkey)); \
1122 TEST_ANNOTATE(NULp); \
1125 #define TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(use,contains) do { \
1126 for (size_t i = 0; i<ARRAY_ELEMS(hkey_format); ++i) { \
1127 const char *hkey = useInHkey(use, i); \
1128 TEST_ANNOTATE(hkey); \
1129 TEST_EXPECT_ERROR_CONTAINS(GB_check_hkey(hkey), contains); \
1131 TEST_ANNOTATE(NULp); \
1135 void TEST_DB_key_checks() {
1137 const char *shortest =
"ab";
1138 const char *too_long =
"ab345678901234567890123456789012345678901234567890123456789012345";
1139 const char *too_short = shortest+1;
1140 const char *longest = too_long+1;
1142 const char *empty =
"";
1143 const char *slash =
"sub/key";
1144 const char *dslash =
"sub//key";
1145 const char *comma =
"no,key";
1146 const char *minus =
"no-key";
1149 const char *
link =
"link->syntax";
1150 const char *nowhere =
"link->";
1151 const char *fromNw =
"->syntax";
1169 TEST_IN_HKEYS_USING_EXPECT_NO_ERROR(shortest);
1170 TEST_IN_HKEYS_USING_EXPECT_NO_ERROR(longest);
1172 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(too_short,
"too short");
1173 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(too_long,
"too long");
1174 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(empty,
"not allowed");
1176 TEST_IN_HKEYS_USING_EXPECT_NO_ERROR(slash);
1177 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(dslash,
"Empty key is not allowed");
1178 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(comma,
"Invalid character ','");
1179 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(minus,
"Invalid character '-'");
1180 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(link,
"Invalid character '-'");
1181 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(nowhere,
"Invalid character '-'");
1182 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(fromNw,
"Invalid character '-'");
1198 #define TEST_STRING2KEY(str,expected) do { \
1199 char *as_key = GBS_string_2_key(str); \
1200 TEST_EXPECT_EQUAL(as_key, expected); \
1201 TEST_EXPECT_NO_ERROR(GB_check_key(as_key)); \
1205 void TEST_DB_key_generation() {
1206 TEST_STRING2KEY(
"abc",
"abc");
1207 TEST_STRING2KEY(
"a b c",
"a_b_c");
1210 TEST_STRING2KEY(
"string containing \"double-quotes\", 'quotes' and other:shit!*&^@!%@(",
1211 "string_containing_doublequotes_quotes_and_othershit");
1214 TEST_STRING2KEY(
"a",
"a_");
1215 TEST_STRING2KEY(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
1216 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
1219 void TEST_TaggedContentParser() {
1237 const char *text =
" untagged [tag] tagged [empty] ";
1239 TextRef cr_untagged(strstr(text,
"untagged"), 8);
1240 TextRef cr_tagged (strstr(text,
"tagged"), 6);
1241 TextRef tr_tag (strstr(text,
"tag"), 3);
1242 TextRef tr_empty (strstr(text,
"empty"), 5);
1250 TEST_EXPECT(parser.get_content().compare(
"untagged") == 0);
1255 TEST_EXPECT(parser.get_tag ().compare(
"tag") == 0);
1256 TEST_EXPECT(parser.get_content().compare(
"tagged") == 0);
1261 TEST_EXPECT(parser.get_tag().compare(
"empty") == 0);
1272 TEST_EXPECT(parser.get_content().compare(
"hi") == 0);
1283 TEST_EXPECT(parser.get_tag().compare(
"hello") == 0);
1292 TEST_EXPECT(parser.get_content().compare(
"t") == 0);
1296 TEST_EXPECT(parser.get_content().compare(
"t") == 0);
1302 #define TEST_MERGE_TAGGED(t1,t2,r1,r2,s1,s2,expected) do { \
1303 char *result = GBS_merge_tagged_strings(s1, t1, r1, s2, t2, r2); \
1304 TEST_EXPECT_EQUAL(result, expected); \
1308 #define TEST_MERGE_TAGGED__BROKEN(t1,t2,r1,r2,s1,s2,expected,got) do { \
1309 char *result = GBS_merge_tagged_strings(s1, t1, r1, s2, t2, r2); \
1310 TEST_EXPECT_EQUAL__BROKEN(result, expected, got); \
1314 void TEST_merge_tagged_strings() {
1316 const char *_0 =
NULp;
1318 TEST_MERGE_TAGGED(
"S",
"D",
"",
"",
"source",
"dest",
"[D_] dest [S_] source");
1319 TEST_MERGE_TAGGED(
"SRC",
"DST",
"", _0,
"source",
"dest",
"[DST] dest [SRC] source");
1320 TEST_MERGE_TAGGED(
"SRC",
"DST", _0,
"",
"source",
"dest",
"[DST] dest [SRC] source");
1321 TEST_MERGE_TAGGED(
"SRC",
"DST", _0, _0,
"sth",
"sth",
"[DST,SRC] sth");
1323 TEST_MERGE_TAGGED(
"SRC",
"DST",
"SRC",
"DST",
"sth",
"sth",
"[DST,SRC] sth");
1324 TEST_MERGE_TAGGED(
"SRC",
"DST",
"SRC",
"DST",
"sth [SRC] del",
"sth [DST] del",
"[DST,SRC] sth");
1327 TEST_MERGE_TAGGED(
"SRC",
"DST", _0,
"SRC",
"newsource",
" [DST] dest [SRC] source",
"[DST] dest [SRC] newsource");
1328 TEST_MERGE_TAGGED(
"SRC",
"DST", _0,
"SRC",
"newsource",
" [DST,SRC] sth",
"[DST] sth [SRC] newsource");
1329 TEST_MERGE_TAGGED(
"SRC",
"DST", _0,
"SRC",
"newsource",
" [DST,src] sth",
"[DST] sth [SRC] newsource");
1330 TEST_MERGE_TAGGED(
"SRC",
"DST", _0,
"src",
"newsource",
" [DST,SRC] sth",
"[DST] sth [SRC] newsource");
1331 TEST_MERGE_TAGGED(
"SRC",
"DST", _0,
"SRC",
"sth",
" [DST] sth [SRC] source",
"[DST,SRC] sth");
1334 TEST_MERGE_TAGGED(
"SRC",
"DST", _0, _0,
"newsource",
"[DST] dest [SRC] source",
"[DST] dest [SRC] newsource [SRC] source");
1335 TEST_MERGE_TAGGED(
"SRC",
"DST", _0, _0,
"newsource",
"[DST,SRC] sth",
"[DST,SRC] sth [SRC] newsource");
1336 TEST_MERGE_TAGGED(
"SRC",
"DST", _0, _0,
"sth",
"[DST] sth [SRC] source",
"[DST,SRC] sth [SRC] source");
1339 TEST_MERGE_TAGGED(
"OTH",
"DST", _0, _0,
"oth",
" [DST] dest [SRC] source",
"[DST] dest [OTH] oth [SRC] source");
1340 TEST_MERGE_TAGGED(
"OTH",
"DST", _0, _0,
"oth",
" [DST,SRC] sth",
"[DST,SRC] sth [OTH] oth");
1341 TEST_MERGE_TAGGED(
"OTH",
"DST", _0, _0,
"sth",
" [DST,SRC] sth",
"[DST,OTH,SRC] sth");
1342 TEST_MERGE_TAGGED(
"OTH",
"DST", _0, _0,
"dest",
" [DST] dest [SRC] source",
"[DST,OTH] dest [SRC] source");
1343 TEST_MERGE_TAGGED(
"OTH",
"DST", _0, _0,
"source",
" [DST] dest [SRC] source",
"[DST] dest [OTH,SRC] source");
1346 TEST_MERGE_TAGGED(
"DST",
"OTH", _0, _0,
" [DST] dest [SRC] source",
"oth",
"[DST] dest [OTH] oth [SRC] source");
1347 TEST_MERGE_TAGGED(
"DST",
"OTH", _0, _0,
" [DST,SRC] sth",
"oth",
"[DST,SRC] sth [OTH] oth");
1348 TEST_MERGE_TAGGED(
"DST",
"OTH", _0, _0,
" [DST,SRC] sth",
"sth",
"[DST,OTH,SRC] sth");
1349 TEST_MERGE_TAGGED(
"DST",
"OTH", _0, _0,
" [DST] dest [SRC] source",
"dest",
"[DST,OTH] dest [SRC] source");
1350 TEST_MERGE_TAGGED(
"DST",
"OTH", _0, _0,
" [DST] dest [SRC] source",
"source",
"[DST] dest [OTH,SRC] source");
1353 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre1 [C1] c1 [C2] c2",
"pre2[C2]c2[C3]c3",
"[C1] c1 [C2] c2 [C3] c3 [P1] pre1 [P2] pre2");
1354 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre [C1] c1 [C2] c2",
"pre [C2]c2 [C3]c3",
"[C1] c1 [C2] c2 [C3] c3 [P1,P2] pre");
1355 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre [C1] c1 [C2] c2",
"pre [c2]c2 [C3]c3",
"[C1] c1 [C2] c2 [C3] c3 [P1,P2] pre");
1356 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre [C1] c1 [C2] c2a",
"pre [C2]c2b [C3]c3",
"[C1] c1 [C2] c2a [C2] c2b [C3] c3 [P1,P2] pre");
1357 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" [C1] c1 [C2] c2a [C2] c2b [C3] c3",
"[C3]c3",
"[C1] c1 [C2] c2a [C2] c2b [C3] c3");
1358 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" [C1] c1 [C2] c2a [C2] c2b [C3] c3",
"[C2] c2b [C3]c3 [C2] c2a",
"[C1] c1 [C2] c2a [C2] c2b [C3] c3");
1359 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre [C1] c1 [C2] c2a",
"pre [c2]c2b [C3]c3",
"[C1] c1 [C2] c2a [C2] c2b [C3] c3 [P1,P2] pre");
1360 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre [C1,C4] c1 [C2] c2a ",
"pre [c2] c2b [C4,C3]c3",
"[C1,C4] c1 [C2] c2a [C2] c2b [C3,C4] c3 [P1,P2] pre");
1361 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre [ C1, C4] c1 [C2 ] c2a ",
"pre [ c2] c2b [C4, C3 ]c3",
"[C1,C4] c1 [C2] c2a [C2] c2b [C3,C4] c3 [P1,P2] pre");
1364 #define DSTSRC1 "[DST] dest1 [SRC] src1"
1365 #define DSTSRC2 "[DST] dest2 [SRC] src2"
1366 #define DSTSRC2LOW "[dst] dest2 [src] src2"
1368 TEST_MERGE_TAGGED(
"O1",
"O2", _0, _0, DSTSRC1, DSTSRC2,
"[DST] dest1 [DST] dest2 [SRC] src1 [SRC] src2");
1369 TEST_MERGE_TAGGED(
"O1",
"O2",
"SRC", _0, DSTSRC1, DSTSRC2,
"[DST] dest1 [DST] dest2 [SRC] src2");
1370 TEST_MERGE_TAGGED(
"O1",
"O2", _0,
"DST", DSTSRC1, DSTSRC2,
"[DST] dest1 [SRC] src1 [SRC] src2");
1371 TEST_MERGE_TAGGED(
"O1",
"O2",
"SRC",
"DST", DSTSRC1, DSTSRC2,
"[DST] dest1 [SRC] src2");
1372 TEST_MERGE_TAGGED(
"O1",
"O2",
"SRC",
"DST", DSTSRC1, DSTSRC2LOW,
"[DST] dest1 [SRC] src2");
1373 TEST_MERGE_TAGGED(
"O1",
"O2",
"src",
"DST", DSTSRC1, DSTSRC2,
"[DST] dest1 [SRC] src2");
1374 TEST_MERGE_TAGGED(
"O1",
"O2",
"src",
"DST", DSTSRC1, DSTSRC2LOW,
"[DST] dest1 [SRC] src2");
1375 TEST_MERGE_TAGGED(
"O1",
"O2",
"SRC",
"dst", DSTSRC1, DSTSRC2,
"[DST] dest1 [SRC] src2");
1376 TEST_MERGE_TAGGED(
"O1",
"O2",
"SRC",
"dst", DSTSRC1, DSTSRC2LOW,
"[DST] dest1 [SRC] src2");
1377 TEST_MERGE_TAGGED(
"O1",
"O2",
"DST",
"SRC", DSTSRC1, DSTSRC2,
"[DST] dest2 [SRC] src1");
1378 TEST_MERGE_TAGGED(
"O1",
"O2",
"DST",
"SRC", DSTSRC1, DSTSRC2LOW,
"[DST] dest2 [SRC] src1");
1379 TEST_MERGE_TAGGED(
"O1",
"O2",
"dst",
"src", DSTSRC1, DSTSRC2,
"[DST] dest2 [SRC] src1");
1380 TEST_MERGE_TAGGED(
"O1",
"O2",
"dst",
"src", DSTSRC1, DSTSRC2LOW,
"[DST] dest2 [SRC] src1");
1381 TEST_MERGE_TAGGED(
"O1",
"O2",
"SRC,DST",
"DST,SRC", DSTSRC1, DSTSRC2,
"[DST] dest1 [DST] dest2 [SRC] src1 [SRC] src2");
1401 #define TEST_EXPECT_TAG_CONTENT(tag,expected) TEST_EXPECT_EQUAL_STRINGCOPY__NOERROREXPORTED(GB_read_as_tagged_string(gb_entry, tag), expected)
1402 #define TEST_REJECT_TAG_CONTENT(tag) TEST_EXPECT_NORESULT__NOERROREXPORTED(GB_read_as_tagged_string(gb_entry, tag))
1403 #define TEST_EXPECT_FULL_CONTENT(tag) TEST_EXPECT_TAG_CONTENT(tag,tagged_string)
1406 const char *tagged_string =
"[T1,T2] t12 [T3] t3[T4]t4[][]xxx[AA]aa[WW]w1 [WW]w2 [BB]bb [XX]x1 [XX]x2 [yy] yy [Y] y [EMPTY][FAKE,EMPTY]fake[ SP1ST, SPACED, PADDED ,UNSPACED,_SCORED_,FOLLOWED ,FOLLAST ] spaced [LAST] last ";
1409 TEST_EXPECT_FULL_CONTENT(
NULp);
1410 TEST_EXPECT_FULL_CONTENT(
"");
1411 TEST_REJECT_TAG_CONTENT(
" ");
1413 TEST_EXPECT_TAG_CONTENT(
"T1",
"t12");
1414 TEST_EXPECT_TAG_CONTENT(
"T2",
"t12");
1415 TEST_EXPECT_TAG_CONTENT(
"T3",
"t3");
1416 TEST_EXPECT_TAG_CONTENT(
"T4",
"t4[][]xxx");
1418 TEST_EXPECT_TAG_CONTENT(
"AA",
"aa");
1419 TEST_EXPECT_TAG_CONTENT(
"BB",
"bb");
1420 TEST_EXPECT_TAG_CONTENT(
"WW",
"w1");
1421 TEST_EXPECT_TAG_CONTENT(
"XX",
"x1");
1422 TEST_EXPECT_TAG_CONTENT(
"YY",
"yy");
1423 TEST_EXPECT_TAG_CONTENT(
"yy",
"yy");
1425 TEST_REJECT_TAG_CONTENT(
"Y");
1428 TEST_EXPECT_TAG_CONTENT(
"EMPTY",
"fake");
1429 TEST_EXPECT_TAG_CONTENT(
"FAKE",
"fake");
1430 TEST_EXPECT_TAG_CONTENT(
"fake",
"fake");
1432 TEST_REJECT_TAG_CONTENT(
"NOSUCHTAG");
1433 TEST_EXPECT_TAG_CONTENT(
"SPACED",
"spaced");
1434 TEST_EXPECT_TAG_CONTENT(
"SP1ST",
"spaced");
1435 TEST_REJECT_TAG_CONTENT(
" SPACED");
1436 TEST_REJECT_TAG_CONTENT(
"_SPACED");
1437 TEST_EXPECT_TAG_CONTENT(
"PADDED",
"spaced");
1438 TEST_EXPECT_TAG_CONTENT(
"FOLLOWED",
"spaced");
1439 TEST_EXPECT_TAG_CONTENT(
"FOLLAST",
"spaced");
1441 TEST_EXPECT_TAG_CONTENT(
"_SCORED_",
"spaced");
1442 TEST_EXPECT_TAG_CONTENT(
" SCORED ",
"spaced");
1443 TEST_EXPECT_TAG_CONTENT(
"UNSPACED",
"spaced");
1444 TEST_EXPECT_TAG_CONTENT(
"LAST",
"last");
1447 tagged_string =
"bla [WHATEVER hello";
1449 TEST_REJECT_TAG_CONTENT(
"WHATEVER");
1451 tagged_string =
"bla [T1] t1 [T2 t2 [T3] t3";
1453 TEST_EXPECT_TAG_CONTENT(
"T1",
"t1 [T2 t2");
1454 TEST_REJECT_TAG_CONTENT(
"T2");
1455 TEST_EXPECT_TAG_CONTENT(
"T3",
"t3");
1458 tagged_string =
"bla [T1] t1 [ ] sp1 [ ] sp2 [___] us [T3] t3 [_a] a";
1460 TEST_EXPECT_TAG_CONTENT(
"T1",
"t1 [ ] sp1 [ ] sp2");
1461 TEST_EXPECT_FULL_CONTENT(
"");
1462 TEST_REJECT_TAG_CONTENT(
" ");
1463 TEST_REJECT_TAG_CONTENT(
" ");
1464 TEST_REJECT_TAG_CONTENT(
",");
1465 TEST_EXPECT_TAG_CONTENT(
", a",
"a");
1466 TEST_EXPECT_TAG_CONTENT(
", a,",
"a");
1467 TEST_EXPECT_TAG_CONTENT(
", ,a,",
"a");
1468 TEST_EXPECT_TAG_CONTENT(
" ",
"us");
1469 TEST_EXPECT_TAG_CONTENT(
"T3",
"t3");
1474 #define TEST_EXPECT_EVAL_TAGGED(in,dtag,tag,aci,expected) do{ \
1475 TEST_EXPECT_EQUAL_STRINGCOPY__NOERROREXPORTED( \
1476 GBS_modify_tagged_string_with_ACI(in, dtag, tag, aci, callEnv), \
1480 #define TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(in,dtag,tag,aci,expectedErrorPart) do{ \
1481 TEST_EXPECT_NORESULT__ERROREXPORTED_CONTAINS( \
1482 GBS_modify_tagged_string_with_ACI(in, dtag, tag, aci, callEnv), \
1483 expectedErrorPart); \
1491 GBL_env env(gb_main,
"tree_missing");
1498 TEST_EXPECT_EVAL_TAGGED(
"bla",
"def",
"tag",
"",
"[DEF] bla");
1499 TEST_EXPECT_EVAL_TAGGED(
"bla",
"def",
"tag",
NULp,
"[DEF] bla");
1500 TEST_EXPECT_EVAL_TAGGED(
"bla",
"def",
"tag",
":bla=blub",
"[DEF] bla");
1501 TEST_EXPECT_EVAL_TAGGED(
"bla",
"tag",
"tag",
":bla=blub",
"[TAG] blub");
1502 TEST_EXPECT_EVAL_TAGGED(
"bla",
"tag",
"tag",
"len",
"[TAG] 3");
1505 TEST_EXPECT_EVAL_TAGGED(
"[empty] ",
"def",
"empty",
NULp,
"");
1506 TEST_EXPECT_EVAL_TAGGED(
"[empty] [filled] xxx",
"def",
"empty",
NULp,
"[FILLED] xxx");
1507 TEST_EXPECT_EVAL_TAGGED(
"[empty] [filled] xxx",
"def",
"empty",
NULp,
"[FILLED] xxx");
1508 TEST_EXPECT_EVAL_TAGGED(
"[empty][filled] xxx",
"def",
"empty",
NULp,
"[FILLED] xxx");
1509 TEST_EXPECT_EVAL_TAGGED(
"[filled] xxx [empty]",
"def",
"empty",
NULp,
"[FILLED] xxx");
1511 #define THREE_TAGS "[TAG] tag [tip] tip [top] top"
1512 #define THREE_TAGS_UPCASE "[TAG] tag [TIP] tip [TOP] top"
1515 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"TAG",
NULp, THREE_TAGS_UPCASE);
1517 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"TAG",
":*=<*>",
"[TAG] <tag> [TIP] tip [TOP] top");
1518 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"tag",
":*=<*>",
"[TAG] <tag> [TIP] tip [TOP] top");
1519 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"tip",
":*=(*)",
"[TAG] tag [TIP] (tip) [TOP] top");
1520 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"TIP",
":*=(*)",
"[TAG] tag [TIP] (tip) [TOP] top");
1521 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"tip",
":*=",
"[TAG] tag [TOP] top");
1522 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"top",
":*=*-*1",
"[TAG] tag [TIP] tip [TOP] top-top");
1523 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"tip",
":i=o",
"[TAG] tag [TIP,TOP] top");
1525 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"tip",
"len",
"[TAG] tag [TIP] 3 [TOP] top");
1526 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"top",
"len",
"[TAG] tag [TIP] tip [TOP] 3");
1529 TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(THREE_TAGS,
"def",
"top",
":*",
"no '=' found");
1530 TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(
"untagged",
"def",
"def",
":*",
"no '=' found");
1531 TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(THREE_TAGS,
"def",
"top",
"illcmd",
"Unknown command 'illcmd'");
1532 TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(
"un [tagged",
"def",
"def",
"illcmd",
"Unknown command 'illcmd'");
1535 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"no",
"illcmd", THREE_TAGS_UPCASE);
1538 TEST_EXPECT_EVAL_TAGGED(
"[no tag",
"def",
"def",
":*=<*>",
"[DEF] <{no tag>");
1539 TEST_EXPECT_EVAL_TAGGED(
"[no tag",
"def",
"def",
":* *=<*2,*1>",
"[DEF] <tag,{no>");
1540 TEST_EXPECT_EVAL_TAGGED(
"[no [tag",
"def",
"def",
":* *=<*2,*1>",
"[DEF] <{tag,{no>");
1541 TEST_EXPECT_EVAL_TAGGED(
"[no [tag] xx",
"def",
"def",
":* *=<*2,*1>",
"[DEF] {no [TAG] xx");
1542 TEST_EXPECT_EVAL_TAGGED(
"[no [tag[]",
"def",
"def",
":* *=<*2,*1>",
"[DEF] <{tag{},{no>");
1543 TEST_EXPECT_EVAL_TAGGED(
"[no [tag[] xx",
"def",
"def",
":* *=<*2,*1>",
"[DEF] <{tag{} xx,{no>");
1544 TEST_EXPECT_EVAL_TAGGED(
"no tag",
"def",
"def",
":* *=<*2,*1>",
"[DEF] <tag,no>");
1545 TEST_EXPECT_EVAL_TAGGED(
"[no tag",
"def",
"def",
":no=yes",
"[DEF] {yes tag");
1546 TEST_EXPECT_EVAL_TAGGED(
"no tag",
"def",
"def",
":no=yes",
"[DEF] yes tag");
1547 TEST_EXPECT_EVAL_TAGGED(
"no tag",
"def",
"DEF",
":no=yes",
"[DEF] yes tag");
1548 TEST_EXPECT_EVAL_TAGGED(
"no tag",
"DEF",
"def",
":no=yes",
"[DEF] yes tag");
1549 TEST_EXPECT_EVAL_TAGGED(
"kept [trunk",
"def",
"def",
":*=<*>",
"[DEF] <kept {trunk>");
1550 TEST_EXPECT_EVAL_TAGGED(
"kept",
"def",
"def",
":*=<*>",
"[DEF] <kept>");
1559 TEST_EXPECT_EVAL_TAGGED(
"[T1,T2] name='$n'",
"def",
"T1",
":$n=*(name)",
"[T1] name='MetMazei' [T2] name='$n'");
1560 TEST_EXPECT_EVAL_TAGGED(
"[T1,T2] seqlen=$l",
"def",
"T2",
":$l=*(|sequence|len)",
"[T1] seqlen=$l [T2] seqlen=165");
1561 TEST_EXPECT_EVAL_TAGGED(
"[T1,T2] nuc",
"def",
"T1",
"dd;\"=\";command(sequence|count(ACGTUN))",
"[T1] nuc=66 [T2] nuc");
1563 TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(
"tax='$t'",
"def",
"def",
":$t=*(|taxonomy(2))",
"Failed to read tree 'tree_missing' (Reason: tree not found)");
1564 TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(
"tax",
"def",
"def",
"dd;\"=\";taxonomy(2)",
"Failed to read tree 'tree_missing' (Reason: tree not found)");
1567 TEST_EXPECT_EVAL_TAGGED(
"untagged [tag] tagged",
"def",
"tag",
":g=G",
"[DEF] untagged [TAG] taGGed");
1568 TEST_EXPECT_EVAL_TAGGED(
" [tag] tagged",
"def",
"tag",
":g=G",
"[TAG] taGGed");
1571 TEST_EXPECT_EVAL_TAGGED(
" untagged ",
"def",
"def",
":g=G",
"[DEF] untaGGed");
1572 TEST_EXPECT_EVAL_TAGGED(
"[tag] tagged ",
"def",
"tag",
":g=G",
"[TAG] taGGed");
1573 TEST_EXPECT_EVAL_TAGGED(
" [trail] trail [tag] tagged ",
"def",
"tag",
":g=G",
"[TAG] taGGed [TRAIL] trail");
1575 #define MIXED_TAGS "[tag] tag [tip,top] tiptop [xx,yy,zz] zzz"
1577 TEST_EXPECT_EVAL_TAGGED(MIXED_TAGS,
"def",
"tip",
":tip=top",
"[TAG] tag [TIP] toptop [TOP] tiptop [XX,YY,ZZ] zzz");
1578 TEST_EXPECT_EVAL_TAGGED(MIXED_TAGS,
"def",
"yy",
":zzz=tiptop",
"[TAG] tag [TIP,TOP,YY] tiptop [XX,ZZ] zzz");
1579 TEST_EXPECT_EVAL_TAGGED(MIXED_TAGS,
"def",
"top",
":tiptop=zzz",
"[TAG] tag [TIP] tiptop [TOP,XX,YY,ZZ] zzz");
1585 void TEST_log_action() {
1586 for (
int stamped = 0; stamped<=1; ++stamped) {
1636 #endif // UNIT_TESTS
static void g_bs_read_tagged_hash(const char *value, long subhash, void *cd_g_bs_collect_tags_hash)
static void g_bs_read_final_hash(const char *tag, long value, void *cd_merge_result)
void GBS_hash_do_const_sorted_loop(const GB_HASH *hs, gb_hash_const_loop_type func, gbs_hash_compare_function sorter, void *client_data)
TextRef partBehind(const TextRef &subref) const
GBDATA * GB_open(const char *path, const char *opent)
TextRef(const char *data_, int length_)
static GB_ERROR tab(GBL_command_arguments *args, bool pretab)
static TextRef textBetween(const TextRef &t1, const TextRef &t2)
long GBS_write_hash(GB_HASH *hs, const char *key, long val)
static void g_bs_convert_string_to_tagged_hash_with_delete(GB_HASH *hash, char *s, char *default_tag, const char *del)
size_t GBS_shorten_repeated_data(char *data)
GB_ERROR GB_write_string(GBDATA *gbd, const char *s)
static const char * EMPTY_KEY_NOT_ALLOWED
static void g_bs_merge_tags(const char *tag, long, void *cd_sub_result)
int ARB_stricmp(const char *s1, const char *s2)
const char * get_data() const
static char * g_bs_get_string_of_tag_hash(GB_HASH *tag_hash)
char * ARB_strdup(const char *str)
char * GB_read_as_string(GBDATA *gbd)
#define TEST_EXPECT_CODE_ASSERTION_FAILS__WANTED(cb)
const char * GBS_global_string(const char *templat,...)
GB_ERROR GB_check_key(const char *key)
GB_HASH * GBS_create_dynaval_hash(long estimated_elements, GB_CASE case_sens, void(*freefun)(long))
void GBS_free_hash(GB_HASH *hs)
TextRef headTrimmed() const
void cat(const char *from)
char * ARB_strpartdup(const char *start, const char *end)
bool is_part_of(const TextRef &other) const
void GBS_fwrite_string(const char *strngi, FILE *out)
char buffer[MESSAGE_BUFFERSIZE]
GB_CSTR GB_getenvARBHOME(void)
GB_CSTR GBS_find_string(GB_CSTR cont, GB_CSTR substr, int match_mode)
TaggedContentParser(const char *input_)
#define TEST_EXPECT_SEGFAULT__UNWANTED(cb)
#define TEST_PUBLISH(testfunction)
#define TEST_EXPECT_CODE_ASSERTION_FAILS__UNWANTED(cb)
int compare(const char *str) const
#define TEST_EXPECT_CONTAINS(str, part)
GB_ERROR GB_export_error(const char *error)
GB_ERROR GB_await_error()
#define TEST_EXPECT(cond)
TextRef tailTrimmed() const
__ATTR__USERESULT GB_ERROR check_key(const char *key, int len)
GBDATA * GB_create(GBDATA *father, const char *key, GB_TYPES type)
const char * find(char c) const
char * GBS_replace_tabs_by_spaces(const char *text)
const char * get_following() const
static long g_bs_free_hash_of_hashes_elem(const char *, long val, void *)
char * GBS_unescape_string(const char *str, const char *escaped_chars, char escape_char)
uint32_t GB_checksum(const char *seq, long length, int ignore_case, const char *exclude)
#define TEST_REJECT(cond)
#define TEST_REJECT_NULL(n)
static void error(const char *msg)
char * GB_memdup(const char *source, size_t len)
const TextRef & get_tag() const
const TextRef & get_content() const
TextRef partBefore(const TextRef &subref) const
void cat_wrapped(const char *in, const char *from)
void GBS_dynaval_free(long val)
static char * GBS_string_2_key_with_exclusions(const char *str, const char *additional)
char * GBS_string_2_key(const char *str)
char * GBS_fconvert_string(char *buffer)
const char * GBS_funptr2readable(void *funptr, bool stripARBHOME)
char * ARB_strupper(char *s)
GB_ERROR GB_write_int(GBDATA *gbd, long i)
void GBS_hash_do_loop(GB_HASH *hs, gb_hash_loop_type func, void *client_data)
#define __ATTR__REDUCED_OPTIMIZE
GB_CSTR GB_getenv(const char *env)
void spaced(const char *word)
static void g_bs_free_hash_of_hashes(GB_HASH *hash)
void ncat(const char *from, size_t count)
char * GB_read_as_tagged_string(GBDATA *gbd, const char *tagi)
#define TEST_EXPECT_NO_SEGFAULT__WANTED(cb)
static char * dated_info(const char *info)
long GBS_gcgchecksum(const char *seq)
char * ARB_strndup(const char *start, int len)
#define TEST_EXPECT_CODE_ASSERTION_FAILS(cb)
int icompare(const char *str) const
static char * GBS_fread_string(FILE *in)
char * GBS_trim(const char *str)
GB_ERROR GB_write_ints(GBDATA *gbd, const GB_UINT4 *i, long size)
#define TEST_EXPECT_NO_SEGFAULT(cb)
#define __ATTR__USERESULT
#define TEST_EXPECT_NO_ERROR(call)
TextRef(const char *zeroTerminated)
#define TEST_EXPECT_SEGFAULT__WANTED(cb)
#define TEST_EXPECT_SEGFAULT(cb)
int GBS_HCF_sortedByKey(const char *k0, long dummy_1x, const char *k1, long dummy_2x)
uint32_t GBS_checksum(const char *seq, int ignore_case, const char *exclude)
static void g_bs_add_value_tag_to_hash(GB_HASH *hash, const char *tag, char *value)
GBDATA * GBT_find_species(GBDATA *gb_main, const char *name)
#define TEST_EXPECT_ERROR_CONTAINS(call, part)
#define TEST_EXPECT_DIFFERENT(expr, want)
bool ARB_strBeginsWith(const char *str, const char *with)
char * GBS_merge_tagged_strings(const char *s1, const char *tag1, const char *replace1, const char *s2, const char *tag2, const char *replace2)
NOT4PERL char * GB_command_interpreter_in_env(const char *str, const char *commands, const GBL_call_env &callEnv)
static GB_ERROR g_bs_convert_string_to_tagged_hash_with_rewrite(GB_HASH *hash, char *s, char *default_tag, const char *rtag, const char *aci, GBL_call_env &env)
char * GBS_escape_string(const char *str, const char *chars_to_escape, char escape_char)
GB_transaction ta(gb_var)
char * GBS_log_action_to(const char *comment, const char *action, bool stamp)
char * GBS_eval_env(GB_CSTR p)
char * GBS_modify_tagged_string_with_ACI(const char *s, const char *dt, const char *tag, const char *aci, GBL_call_env &env)
static int info[maxsites+1]
GB_ERROR GB_check_hkey(const char *key)
#define TEST_EXPECT_EQUAL(expr, want)
char * release_memfriendly()
long GBS_read_hash(const GB_HASH *hs, const char *key)
char * GBS_global_string_copy(const char *templat,...)
void GB_close(GBDATA *gbd)
GB_HASH * GBS_create_hash(long estimated_elements, GB_CASE case_sens)
GB_write_int const char s