44 using namespace basis;
68 virtual int execute();
118 #define LOG(s) EMERGENCY_LOG(program_wide_logger::get(), s)
120 #define WHERE __WHERE__.s()
123 #define test(expr) { \
124 ASSERT_FALSE(expr, astring("operator test should work: ") + #expr); \
132 void test_string::run_test_01()
152 ASSERT_EQUAL(fred1.length(),
int(strlen(fred1.s())),
"length should be correct (a).");
153 ASSERT_EQUAL(fred2.length(),
int(strlen(fred2.s())),
"length should be correct (b).");
155 ASSERT_EQUAL(fred4.length(),
int(strlen(fred4.s())),
"length should be correct (d).");
157 #ifdef DEBUG_STRING_TEST
158 LOG(
"[ " + fred1 +
" & " + fred2 +
"] -> " + fred3);
165 ASSERT_EQUAL(fred4, fred2,
"failure in comparison (d-2).");
170 ASSERT_EQUAL(nullo, astring::empty_string(),
"forward blank a_sprintf isn't empty.");
171 ASSERT_EQUAL(astring::empty_string(), nullo,
"backward blank a_sprintf isn't empty.");
174 void test_string::run_test_02()
188 #ifdef DEBUG_STRING_TEST
189 LOG(
astring(
"[ ") + *fred1 +
" & " + *fred2 +
"] -> " + *fred3);
194 ASSERT_EQUAL(*fred3,
astring(
"flipper ate my sandwich."),
"full f-s A failure in comparison");
200 void test_string::run_test_03()
204 astring fleermipe(
"hello my frobious.");
205 fleermipe.zap(0, fleermipe.length() - 1);
206 ASSERT_EQUAL(fleermipe.length(), 0,
"length not 0 after deleting entire astring");
209 void test_string::run_test_04()
212 astring test_string(
"this test string will be chopped up.");
213 #ifdef DEBUG_STRING_TEST
217 fred.zap(0, fred.find(
'w'));
219 #ifdef DEBUG_STRING_TEST
220 LOG(
astring(
"now, the one chopped through 'w' is: ") + fred);
226 blorg.zap(blorg.find(
'p'), blorg.length() - 1);
227 #ifdef DEBUG_STRING_TEST
228 LOG(
astring(
"now the one chopped from p to the end: ") + blorg);
234 fleen += test_string;
236 #ifdef DEBUG_STRING_TEST
237 LOG(
astring(
"now the one with 7 through 14 missing: ") + fleen);
242 #ifdef DEBUG_STRING_TEST
243 LOG(
astring(
"original astring is now: ") + test_string);
246 "original astring was changed");
249 void test_string::run_test_05()
252 #ifdef DEBUG_STRING_TEST
253 LOG(
"about to test weird things:");
259 test(frieda != jorb);
260 test(jorb != *kleeg);
261 test(*kleeg != plok);
262 test(plok != frieda);
264 test(frieda != glorp);
268 #ifdef DEBUG_STRING_TEST
269 LOG(
"strings matched up okay.");
273 astring bubba(
"gumpternations");
275 #ifdef DEBUG_STRING_TEST
284 #ifdef DEBUG_STRING_TEST
289 astring simple_spr0(astring::SPRINTF,
"%% yoga splorch %%");
290 #ifdef DEBUG_STRING_TEST
291 LOG(
astring(
"simple sprintf 0 = ") + simple_spr0);
294 astring simple_spr1(astring::SPRINTF,
"%d", 23);
295 #ifdef DEBUG_STRING_TEST
296 LOG(
astring(
"simple sprintf 1 = ") + simple_spr1);
299 astring simple_spr2(astring::SPRINTF,
"%s",
"yoyo");
300 #ifdef DEBUG_STRING_TEST
301 LOG(
astring(
"simple sprintf 2 = ") + simple_spr2);
305 astring sprintest(astring::SPRINTF,
"%s has got me up the %s some %d "
306 "times, in %p with %d and %lu.",
"marge",
"ladder", 32, &kleeg,
307 812377487L, 213123123L);
309 sprintest2.
reset(astring::SPRINTF,
"%s has got me up the %s some %d "
310 "times, in %p with %d and %lu.",
"marge",
"ladder", 32, &kleeg,
311 812377487L, 213123123L);
312 astring addr(astring::SPRINTF,
"%p", &kleeg);
313 #ifdef DEBUG_STRING_TEST
314 LOG(
"here is your astring sir...");
316 LOG(
"and addr we will see is...");
319 if (sprintest !=
astring(astring::SPRINTF,
"marge has got me up the "
320 "ladder some 32 times, in %s with 812377487 and 213123123.", addr.s()))
321 "constructed astring is wrong";
322 if (sprintest2 !=
astring(astring::SPRINTF,
"marge has got me up the "
323 "ladder some 32 times, in %s with 812377487 and 213123123.", addr.s()))
324 "reset astring is wrong";
327 void test_string::run_test_06()
331 bungee +=
"this astring";
332 bungee +=
" has been constructed gradua";
336 astring blorpun(astring::SPRINTF,
" out of severa%c",
'l');
338 bungee +=
" different bits,\nincluding";
339 astring freeple(astring::SPRINTF,
"%s constructed %s blarg from %f ",
" this",
"silly", 3.14159265358);
341 bungee +=
"radians awa";
344 bungee +=
"\nhow does it look?\n";
345 #ifdef DEBUG_STRING_TEST
350 ASSERT_EQUAL(bungee,
astring(
"this astring has been constructed gradually out of several different bits,\nincluding this constructed silly blarg from 3.141593 radians away.\nhow does it look?\n"),
"constructed astring is wrong");
353 void test_string::run_test_07()
367 #ifdef DEBUG_STRING_TEST
368 LOG(
"comparisons worked");
372 void test_string::run_test_08()
375 #ifdef DEBUG_STRING_TEST
376 LOG(
"now testing + operator");
384 #ifdef DEBUG_STRING_TEST
389 #ifdef DEBUG_STRING_TEST
394 #ifdef DEBUG_STRING_TEST
402 void test_string::run_test_09()
405 astring bleer(astring::SPRINTF,
"urghla burgla #%d\n", 23);
407 for (
int i = 0; i < bleer.length(); i++) {
408 bleer.stuff(holder, i);
409 #ifdef DEBUG_STRING_TEST
410 LOG(
astring(astring::SPRINTF,
"%d", i) +
" has: " + holder);
413 my_copy.zap(i, bleer.length() - 1);
418 void test_string::run_test_10()
421 #ifdef DEBUG_STRING_TEST
422 LOG(
"The tenth ones:");
424 astring george(
"this one will be mangled.");
425 ASSERT_EQUAL(george.length(),
int(strlen(george.s())),
"length is incorrect (q).");
426 astring tmp1(george.substring(1, 7));
428 #ifdef DEBUG_STRING_TEST
429 LOG(tmp1 +
"... " + tmp2);
432 ASSERT_FALSE( (tmp1 > tmp2) || (tmp2 < tmp1),
"bizarre comparison error.");
433 ASSERT_EQUAL(george.length(),
int(strlen(george.s())),
"length is incorrect (z).");
434 #ifdef DEBUG_STRING_TEST
435 LOG(george.substring(1, 7));
437 LOG(george.substring(10, george.length() - 1));
439 ASSERT_EQUAL(george.length(),
int(strlen(george.s())),
"length is incorrect (a).");
440 george.insert(14,
"terribly ");
441 ASSERT_EQUAL(george.length(),
int(strlen(george.s())),
"length is incorrect (b).");
442 #ifdef DEBUG_STRING_TEST
446 astring mssr_boef_la_tet(
"eeyoy eye eye capn");
447 mssr_boef_la_tet.substring(chunky, 2, 7);
451 ASSERT_TRUE(george.compare(fred, 0, 0, george.length() - 1,
true),
"did not work");
452 ASSERT_TRUE(george.compare(fred, 8, 8, george.length() - 1 - 8,
true),
"partial did not work");
454 astring taco1(
"iLikeTacosNSuch");
455 astring taco2(
"iLikeTaCosNSuch");
456 ASSERT_TRUE(taco1.compare(taco2, 0, 0, taco1.length() - 1,
false),
457 "tacos case-insensitive compare A did not work");
458 ASSERT_FALSE(taco1.compare(taco2, 0, 0, taco1.length() - 1,
true),
459 "tacos case-sensitive compare B did not work");
461 ASSERT_EQUAL(george.length(),
int(strlen(george.s())),
"length is incorrect (c).");
463 #ifdef DEBUG_STRING_TEST
469 ASSERT_TRUE(george.compare(fred_part, 0, 0, 13,
true),
"did not work");
470 fred_part = fred.
substring(23, fred.length() - 1);
472 ASSERT_TRUE(george.compare(fred_part, 14, 0, fred_part.
length() - 1,
true),
"did not work");
473 #ifdef DEBUG_STRING_TEST
474 LOG(
"compares okay");
478 void test_string::run_test_11()
483 ASSERT_TRUE(!empty,
"not on empty string doesn't work");
485 ASSERT_TRUE(non_empty.length(),
"non-empty string judged empty");
486 ASSERT_FALSE(!non_empty,
"not on non-empty string doesn't work");
489 void test_string::run_test_12()
492 astring elf0(astring::SPRINTF,
"%%_%%_%%");
493 ASSERT_FALSE(strcmp(elf0.s(),
"%_%_%"),
"failed %% printing");
495 char fred[6] = {
'h',
'y',
'a',
'r',
'g',
'\0' };
496 astring fred_copy(astring::UNTERMINATED, fred, 5);
497 ASSERT_EQUAL(fred_copy.length(), 5,
"length of copy is wrong");
500 char hugh[6] = {
'o',
'y',
'o',
'b',
'o',
'y' };
501 astring hugh_copy(astring::UNTERMINATED, hugh, 3);
502 ASSERT_EQUAL(hugh_copy.length(), 3,
"length of copy is wrong");
506 another_copy.
reset(astring::UNTERMINATED, fred, strlen(fred));
511 void test_string::run_test_13()
515 const astring churg(
"borjh sjh oiweoklj");
517 astring flug =
"kase iqk aksjir kljasdo";
518 const char *nerf =
"ausd qwoeui sof zjh qwei";
526 void test_string::run_test_14()
530 const int longish_size = 5000;
531 char temp[longish_size];
532 for (
int i = 0; i < longish_size; i++)
534 temp[longish_size - 1] =
'\0';
535 a_sprintf longish(
"this is a really darned long string of stuff: %s,\nbut doesn't it look interesting?",
temp);
537 longish.zap(longish.length() / 3, 2 * longish.length() / 3);
539 ASSERT_EQUAL(longish.length(),
int(strlen(longish.s())),
"length is incorrect.");
542 void test_string::run_test_15()
547 astring testy(astring::SPRINTF,
"%d", try_1);
548 ASSERT_INEQUAL(testy.convert(95), 95,
"default value returned, so it failed.");
549 ASSERT_EQUAL(testy.convert(95), try_1,
"correct value was not returned.");
551 long try_2 = 2938754L;
552 testy =
astring(astring::SPRINTF,
"%ld", try_2);
553 ASSERT_INEQUAL((
double)testy.convert(98L), (
double)98L,
"default value returned, so it failed.");
554 ASSERT_EQUAL((
double)testy.convert(98L), (
double)try_2,
"correct value was not returned.");
556 testy =
astring(astring::SPRINTF,
"%ld", try_2);
557 ASSERT_INEQUAL((
double)testy.convert(98L), (
double)98L,
"default value returned, so it failed.");
558 ASSERT_EQUAL((
double)testy.convert(98L), (
double)try_2,
"correct value was not returned.");
560 float try_3 = float(2938.754);
561 testy =
astring(astring::SPRINTF,
"%f", try_3);
562 float found = testy.convert(
float(98.6));
563 ASSERT_INEQUAL(found, 98.6,
"default value returned, so it failed.");
564 ASSERT_EQUAL(found, try_3,
"correct value was not returned.");
567 double try_4 = 25598437.712385;
568 testy =
astring(astring::SPRINTF,
"%f", try_4);
569 double found2 = testy.convert(
double(98.6));
570 ASSERT_INEQUAL(found2, 98.6,
"default value returned, so it failed.");
571 ASSERT_EQUAL(found2, try_4,
"correct value was not returned.");
575 double try_4 = 25598437.712385e38;
576 testy =
astring(astring::SPRINTF,
"%f", try_4);
577 double found2 = testy.convert(
double(98.6));
578 ASSERT_INEQUAL(found2, 98.6,
"default value returned, so it failed.");
579 ASSERT_EQUAL(found2, try_4,
"correct value was not returned.");
583 void test_string::run_test_16()
588 for (
int i = -3; i < 25; i++) gorf[i] =
't';
590 ASSERT_EQUAL(gorf.length(), 3,
"length is incorrect (a).");
591 gorf.insert(3,
astring(
"bru"));
593 ASSERT_EQUAL(gorf.length(), 6,
"length is incorrect (b).");
594 gorf.insert(35,
astring(
"snu"));
596 ASSERT_EQUAL(gorf.length(), 6,
"length is incorrect (c).");
597 gorf.insert(-30,
astring(
"eep"));
599 ASSERT_EQUAL(gorf.length(), 6,
"length is incorrect (d).");
602 void test_string::run_test_17()
613 void test_string::run_test_18()
615 #ifdef DEBUG_STRING_TEST
624 astring libname = rc_string(IDS_BASIS_NAME);
626 astring(
"library name is a mismatch: comes out as \"") + libname +
"\".");
627 #define IDS_SOME_BAD_UNKNOWN_STRING_HANDLE 30802
628 astring bogus_name = rc_string(IDS_SOME_BAD_UNKNOWN_STRING_HANDLE);
636 #ifdef DEBUG_STRING_TEST
637 LOG(
astring(
"cstringy conversions: ") + george);
638 LOG((
const char *)hal);
646 void test_string::run_test_19()
650 astring problematic_example(astring::SPRINTF,
"this should have %d% more "
651 "stuffing than before!", 20);
653 ASSERT_EQUAL(problematic_example,
astring(
"this should have 20% more stuffing than before!"),
"failure to print correct phrase");
656 void test_string::run_test_20()
658 #ifdef DEBUG_STRING_TEST
664 char myText[] =
"OK";
665 astring myString(astring::SPRINTF,
"%04s", myText);
666 #ifdef DEBUG_STRING_TEST
670 char myText8[] =
"OK";
672 sprintf(my_text_4,
"%4s", myText8);
673 #ifdef DEBUG_STRING_TEST
679 char myText2[] =
"OK";
681 sprintf(myText3,
"%4s", myText2);
683 #ifdef DEBUG_STRING_TEST
688 void test_string::run_test_21()
694 temp.strip_spaces(astring::FROM_FRONT);
697 temp.strip_spaces(astring::FROM_END);
700 temp.strip_spaces(astring::FROM_BOTH_SIDES);
703 astring placemat(
"mary had a red hooded cobra she kept around her neck "
704 "and it hissed at the people as they walked by her tent.");
705 ASSERT_TRUE(placemat.replace(
"had",
"bought"),
"replace failed");
706 ASSERT_TRUE(!placemat.replace(
"hoded",
"bought"),
"replace didn't fail but should have");
707 ASSERT_TRUE(placemat.replace(
"she",
"funkateria"),
"replace failed");
708 ASSERT_TRUE(placemat.replace(
"hooded",
"hood"),
"replace failed");
709 ASSERT_TRUE(placemat.replace(
"cobra",
"in the"),
"replace failed");
711 int indy = placemat.find(
"kept");
713 placemat[indy - 1] =
'.';
714 placemat.zap(indy, placemat.end());
715 ASSERT_EQUAL(placemat,
astring(
"mary bought a red hood in the funkateria."),
"got wrong result string");
718 void test_string::run_test_22()
736 int x = B.find(
"z*");
749 void test_string::run_test_23()
753 astring strip_string(
"!@#$%^&*()");
755 astring no_stripper(
"this shouldn't change");
756 no_stripper.strip(strip_string, astring::FROM_BOTH_SIDES);
757 ASSERT_EQUAL(no_stripper,
astring(
"this shouldn't change"),
"first test failed comparison");
759 astring strippee_orig(
"&$(*(@&@*()()!()@*(@(*fudge#((@(*@**#)(@#)(#");
760 astring strippee(strippee_orig);
761 strippee.strip(strip_string, astring::FROM_BOTH_SIDES);
764 strippee = strippee_orig;
765 strippee.strip(strip_string, astring::FROM_FRONT);
768 strippee = strippee_orig;
769 strippee.strip(strip_string, astring::FROM_END);
770 ASSERT_EQUAL(strippee,
astring(
"&$(*(@&@*()()!()@*(@(*fudge"),
"fourth test failed comparison");
773 void test_string::run_test_24()
776 #ifndef __GNU_WINDOWS__
779 _bstr_t beast(
"abcdefgh");
780 #ifdef DEBUG_STRING_TEST
781 LOG(
astring(
"the beast is ") + beast.operator
char *() +
782 astring(astring::SPRINTF,
" with length %d", beast.length()));
785 #ifdef DEBUG_STRING_TEST
787 +
astring(astring::SPRINTF,
" with length %d",
convert.length()));
791 astring jethro(
"i want a hog sandwich");
792 _bstr_t pork = string_convert::to_bstr_t(jethro);
793 ASSERT_FALSE(strcmp(pork.operator
char *(), jethro.s()),
"second test failed comparison");
798 void test_string::run_test_25()
805 ASSERT_EQUAL(fred, bub,
"second test failed comparison");
811 void test_string::run_test_26()
816 astring t2 = time_stamp::notarize(
false);
817 astring t4 = time_stamp::notarize(
true);
820 void test_string::run_test_27()
833 void test_string::run_test_28()
840 astring testy(astring::SPRINTF,
"%u:%hu:%c", in1, in2, in3);
844 void test_string::run_test_29()
848 astring a(
"would an onion smell so sweet?");
854 a =
"128 salamanders cannot be wrong.";
860 #define static_class_name() "test_string"
864 FUNCDEF(
"standard_sprintf_test");
865 astring print_into(
' ', 20000);
866 print_into[0] =
'\0';
872 sprintf(print_into.
s(),
"%d %ld %u %hu %s", i1, l1, u1, s1, parm_string);
873 sprintf(print_into.
s(),
"%c %d %c %s %s %lu",
char(
rando.
inclusive(
'a',
'z')),
878 #undef static_class_name
880 void test_string::run_test_30()
884 astring parm_string = string_manipulation::make_random_name(40, 140);
885 astring print_into(
' ', 20000);
886 print_into[0] =
'\0';
891 char test_same[20010];
892 sprintf(test_same,
"%d %ld %u %hu %s", i1, l1, u1, s1, parm_string.
s());
893 print_into.sprintf(
"%d %ld %u %hu %s", i1, l1, u1, s1, parm_string.
s());
894 ASSERT_EQUAL(
astring(test_same), print_into,
"sprintf should get same results as standard");
896 print_into.sprintf(
"%c %d %c %s %s %lu",
char(
rando.
inclusive(
'a',
'z')),
901 void test_string::run_test_31()
916 void test_string::run_test_32()
921 const int CHUNK_SIZE = 2 *
MEGABYTE;
924 const int MIN_ADDITION = 10000;
const int MAX_ADDITION = 80000;
926 const int BUILD_AND_BURN_ITERATIONS = 1;
935 for (
int iters = 0; iters < BUILD_AND_BURN_ITERATIONS; iters++) {
940 while (slab.
length() < CHUNK_SIZE - MAX_ADDITION - 20) {
942 astring addition = string_manipulation::make_random_name(MIN_ADDITION,
945 size += addition.
length();
955 int range_length = zap_end - zap_start + 1;
957 slab.
zap(zap_start, zap_end);
958 size -= range_length;
964 void test_string::run_test_33()
969 astring to_modify(
"\\\\feeby\\path\\yo");
970 ASSERT_TRUE(to_modify.replace(
"\\",
"/"),
"failed to replace the string");
972 while (to_modify.replace(
"\\",
"/")) {}
976 astring to_modify(
"\\superduper\\dynamo\\looper");
977 ASSERT_TRUE(to_modify.replace(
"\\",
"/"),
"failed to replace the string");
978 ASSERT_EQUAL(to_modify,
astring(
"/superduper\\dynamo\\looper"),
"produced wrong resultant string");
979 while (to_modify.replace(
"\\",
"/")) {}
980 ASSERT_EQUAL(to_modify,
astring(
"/superduper/dynamo/looper"),
"produced wrong final string");
985 while (id1.
replace(
"/",
" ")) {}
991 while (id2.
replace(
"=",
":")) {}
998 void test_string::run_test_34()
1006 void test_string::run_test_35()
1011 ASSERT_EQUAL(termo.length(), 2812,
"length should be as requested");
1014 ASSERT_EQUAL(termo.get_implementation().internal_real_length(), 1010,
a_sprintf(
"failure in shrunken size: " "wanted 1010 and got %d.", termo.get_implementation().internal_real_length()));
1019 void test_string::run_test_36()
1027 torpid +=
"petunia";
1028 torpid +=
"dumptruck";
1031 sacral +=
"gumboat";
1035 paknid +=
"gorboochy";
1036 paknid +=
"rangolent";
1045 stongent +=
"pemulack";
1046 stongent +=
"bluzzent";
1047 stongent +=
"crupto";
1048 stongent +=
"floonack";
1049 stongent +=
"atoona";
1058 void test_string::run_test_37()
1063 astring a(
"would an onion smell so sweet?");
1069 a =
"128 salamanders cannot be wrong.";
1075 void test_string::run_test_38()
1078 double to_print = 2.345;
1082 to_print = 1.797E+254;
1087 sprintf(
bucket,
"%.1f", to_print);
1094 void test_string::run_test_39()
1097 const char *find_set =
"!?.;";
1098 astring test_1 =
"how do i get to balthazar square? it stinks!";
1104 void test_string::run_test_40()
1108 #define test_name() a_sprintf("test %d: ", test_num)
1142 astring target =
"suzzle rumpetzzes gnargle rezztor";
1158 astring target =
"glorg snorp pendle funk";
1167 void test_string::run_test_41()
1171 #define test_name() a_sprintf("test %d: ", test_num)
1175 const char *finding1 =
"ab";
1177 const char *finding2 =
"xb";
1179 const char *finding3 =
"c";
1182 test_name() +
"wrong answer for test D");
1186 astring target =
"abcadefghoota";
1187 const char *finding1 =
"bcdfghot";
1200 void test_string::run_test_42()
1204 astring hobnob(
"all the best robots are bending robots");
1207 ASSERT_EQUAL(hobnob.right(10),
astring(
"ing robots"),
"failed to find right side of string");
1213 int test_string::execute()
1218 ASSERT_EQUAL(1, 1,
"non-fake assertion to test jenkins log parsing");
1229 #ifdef DEBUG_STRING_TEST
1230 LOG(
astring(astring::SPRINTF,
"index %d", i));
1278 return final_report();
The application_shell is a base object for console programs.
a_sprintf is a specialization of astring that provides printf style support.
void reset(int number=0, const contents *initial_contents=NULL_POINTER)
Resizes this array and sets the contents from an array of contents.
int length() const
Returns the current reported length of the allocated C array.
Provides a dynamically resizable ASCII character string.
const char * s() const
synonym for observe. the 's' stands for "string", if that helps.
bool replace(const astring &tag, const astring &replacement)
replaces the first occurrence of "tag" text with the "replacement".
virtual void zap(int start, int end)
Deletes the characters between "start" and "end" inclusively.
bool substring(astring &target, int start, int end) const
a version that stores the substring in an existing "target" string.
void reset()
clears out the contents string.
int find_non_match(const char *to_find, int position=0, bool reverse=false) const
searches for any character that is not in "to_find" and returns index.
int end() const
returns the index of the last (non-null) character in the string.
int find_any(const char *to_find, int position=0, bool reverse=false) const
searches for any of the characters in "to_find".
bool replace_all(char to_replace, char new_char)
changes all occurrences of "to_replace" with "new_char".
int length() const
Returns the current length of the string.
bool unpack(byte_array &source)
retrieves a string (packed with pack()) from "source" into this string.
virtual const char * observe() const
observes the underlying pointer to the zero-terminated string.
A very common template for a dynamic array of bytes.
a platform-independent way to acquire random numbers in a specific range.
int inclusive(int low, int high) const
< Returns a pseudo-random number r, such that "low" <= r <= "high".
An array of strings with some additional helpful methods.
basis::astring text_form() const
A synonym for the text_format() method.
A specific point in time as represented by a 24 hour clock.
basis::astring text_form(int how=MERIDIAN) const
Prints the clock_time according to "how".
An object that represents a particular day in a year.
basis::astring text_form(int how=SHORT_MONTH) const
Prints the day according to "how".
An object that represents a particular point in time.
basis::astring text_form_long(int t=clock_time::MERIDIAN, int d=day_in_year::SHORT_MONTH, int y=LONG_YEAR) const
Represents a point in time relative to the operating system startup time.
#define NULL_POINTER
The value representing a pointer to nothing.
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Provides macros that implement the 'main' program of an application.
#define HOOPLE_MAIN(obj_name, obj_args)
options that should work for most unix and linux apps.
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
const int MEGABYTE
Number of bytes in a megabyte.
unsigned long un_long
Abbreviated name for unsigned long integers.
unsigned int un_int
Abbreviated name for unsigned integers.
void flip_increasing(type &a, type &b)
Makes sure that two values are in increasing order (a < b).
unsigned short un_short
Abbreviated name for unsigned short integers.
bool negative(const type &a)
negative returns true if "a" is less than zero.
const int MINUTE_ms
Number of milliseconds in a minute.
A logger that sends to the console screen using the standard output device.
An extension to floating point primitives providing approximate equality.
A dynamic container class that holds any kind of object via pointers.
bool unpack_array(basis::byte_array &packed_form, basis::array< contents > &to_unpack)
provides a way to unpack any array that stores packable objects.
void pack_array(basis::byte_array &packed_form, const basis::array< contents > &to_pack)
provides a way to pack any array that stores packable objects.
time_locus now()
returns our current locus in the time continuum.
clock_time time_now()
what time is it?
time_locus convert(time_number seconds, time_number useconds, const tm &cal_values)
day_in_year date_now()
what day on the calendar is it?
Useful support functions for unit testing, especially within hoople.
const float TEST_RUNTIME_DEFAULT
void standard_sprintf_test(const char *parm_string)
#define ASSERT_EQUAL(a, b, test_name)
#define ASSERT_TRUE(a, test_name)
#define ASSERT_FALSE(a, test_name)
#define ASSERT_INEQUAL(a, b, test_name)
#define GET_INSTANCE_HANDLE()
a handy macro that frees one from knowing the name of the handle.