44 using namespace basis;
70 virtual int execute();
120 #define LOG(s) EMERGENCY_LOG(program_wide_logger::get(), s)
122 #define WHERE __WHERE__.s()
125 #define test(expr) { \
126 ASSERT_FALSE(expr, astring("operator test should work: ") + #expr); \
134 void test_string::run_test_01()
154 ASSERT_EQUAL(fred1.length(),
int(strlen(fred1.s())),
"length should be correct (a).");
155 ASSERT_EQUAL(fred2.length(),
int(strlen(fred2.s())),
"length should be correct (b).");
157 ASSERT_EQUAL(fred4.length(),
int(strlen(fred4.s())),
"length should be correct (d).");
159 #ifdef DEBUG_STRING_TEST
160 LOG(
"[ " + fred1 +
" & " + fred2 +
"] -> " + fred3);
167 ASSERT_EQUAL(fred4, fred2,
"failure in comparison (d-2).");
172 ASSERT_EQUAL(nullo, astring::empty_string(),
"forward blank a_sprintf isn't empty.");
173 ASSERT_EQUAL(astring::empty_string(), nullo,
"backward blank a_sprintf isn't empty.");
176 void test_string::run_test_02()
190 #ifdef DEBUG_STRING_TEST
191 LOG(
astring(
"[ ") + *fred1 +
" & " + *fred2 +
"] -> " + *fred3);
196 ASSERT_EQUAL(*fred3,
astring(
"flipper ate my sandwich."),
"full f-s A failure in comparison");
202 void test_string::run_test_03()
206 astring fleermipe(
"hello my frobious.");
207 fleermipe.zap(0, fleermipe.length() - 1);
208 ASSERT_EQUAL(fleermipe.length(), 0,
"length not 0 after deleting entire astring");
211 void test_string::run_test_04()
214 astring test_string(
"this test string will be chopped up.");
215 #ifdef DEBUG_STRING_TEST
219 fred.zap(0, fred.find(
'w'));
221 #ifdef DEBUG_STRING_TEST
222 LOG(
astring(
"now, the one chopped through 'w' is: ") + fred);
228 blorg.zap(blorg.find(
'p'), blorg.length() - 1);
229 #ifdef DEBUG_STRING_TEST
230 LOG(
astring(
"now the one chopped from p to the end: ") + blorg);
236 fleen += test_string;
238 #ifdef DEBUG_STRING_TEST
239 LOG(
astring(
"now the one with 7 through 14 missing: ") + fleen);
244 #ifdef DEBUG_STRING_TEST
245 LOG(
astring(
"original astring is now: ") + test_string);
248 "original astring was changed");
251 void test_string::run_test_05()
254 #ifdef DEBUG_STRING_TEST
255 LOG(
"about to test weird things:");
261 test(frieda != jorb);
262 test(jorb != *kleeg);
263 test(*kleeg != plok);
264 test(plok != frieda);
266 test(frieda != glorp);
270 #ifdef DEBUG_STRING_TEST
271 LOG(
"strings matched up okay.");
275 astring bubba(
"gumpternations");
277 #ifdef DEBUG_STRING_TEST
286 #ifdef DEBUG_STRING_TEST
291 astring simple_spr0(astring::SPRINTF,
"%% yoga splorch %%");
292 #ifdef DEBUG_STRING_TEST
293 LOG(
astring(
"simple sprintf 0 = ") + simple_spr0);
296 astring simple_spr1(astring::SPRINTF,
"%d", 23);
297 #ifdef DEBUG_STRING_TEST
298 LOG(
astring(
"simple sprintf 1 = ") + simple_spr1);
301 astring simple_spr2(astring::SPRINTF,
"%s",
"yoyo");
302 #ifdef DEBUG_STRING_TEST
303 LOG(
astring(
"simple sprintf 2 = ") + simple_spr2);
307 astring sprintest(astring::SPRINTF,
"%s has got me up the %s some %d "
308 "times, in %p with %d and %lu.",
"marge",
"ladder", 32, &kleeg,
309 812377487L, 213123123L);
311 sprintest2.
reset(astring::SPRINTF,
"%s has got me up the %s some %d "
312 "times, in %p with %d and %lu.",
"marge",
"ladder", 32, &kleeg,
313 812377487L, 213123123L);
314 astring addr(astring::SPRINTF,
"%p", &kleeg);
315 #ifdef DEBUG_STRING_TEST
316 LOG(
"here is your astring sir...");
318 LOG(
"and addr we will see is...");
321 if (sprintest !=
astring(astring::SPRINTF,
"marge has got me up the "
322 "ladder some 32 times, in %s with 812377487 and 213123123.", addr.s()))
323 "constructed astring is wrong";
324 if (sprintest2 !=
astring(astring::SPRINTF,
"marge has got me up the "
325 "ladder some 32 times, in %s with 812377487 and 213123123.", addr.s()))
326 "reset astring is wrong";
329 void test_string::run_test_06()
333 bungee +=
"this astring";
334 bungee +=
" has been constructed gradua";
338 astring blorpun(astring::SPRINTF,
" out of severa%c",
'l');
340 bungee +=
" different bits,\nincluding";
341 astring freeple(astring::SPRINTF,
"%s constructed %s blarg from %f ",
" this",
"silly", 3.14159265358);
343 bungee +=
"radians awa";
346 bungee +=
"\nhow does it look?\n";
347 #ifdef DEBUG_STRING_TEST
352 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");
355 void test_string::run_test_07()
369 #ifdef DEBUG_STRING_TEST
370 LOG(
"comparisons worked");
374 void test_string::run_test_08()
377 #ifdef DEBUG_STRING_TEST
378 LOG(
"now testing + operator");
386 #ifdef DEBUG_STRING_TEST
391 #ifdef DEBUG_STRING_TEST
396 #ifdef DEBUG_STRING_TEST
404 void test_string::run_test_09()
407 astring bleer(astring::SPRINTF,
"urghla burgla #%d\n", 23);
409 for (
int i = 0; i < bleer.length(); i++) {
410 bleer.stuff(holder, i);
411 #ifdef DEBUG_STRING_TEST
412 LOG(
astring(astring::SPRINTF,
"%d", i) +
" has: " + holder);
415 my_copy.zap(i, bleer.length() - 1);
420 void test_string::run_test_10()
423 #ifdef DEBUG_STRING_TEST
424 LOG(
"The tenth ones:");
426 astring george(
"this one will be mangled.");
427 ASSERT_EQUAL(george.length(),
int(strlen(george.s())),
"length is incorrect (q).");
428 astring tmp1(george.substring(1, 7));
430 #ifdef DEBUG_STRING_TEST
431 LOG(tmp1 +
"... " + tmp2);
434 ASSERT_FALSE( (tmp1 > tmp2) || (tmp2 < tmp1),
"bizarre comparison error.");
435 ASSERT_EQUAL(george.length(),
int(strlen(george.s())),
"length is incorrect (z).");
436 #ifdef DEBUG_STRING_TEST
437 LOG(george.substring(1, 7));
439 LOG(george.substring(10, george.length() - 1));
441 ASSERT_EQUAL(george.length(),
int(strlen(george.s())),
"length is incorrect (a).");
442 george.insert(14,
"terribly ");
443 ASSERT_EQUAL(george.length(),
int(strlen(george.s())),
"length is incorrect (b).");
444 #ifdef DEBUG_STRING_TEST
448 astring mssr_boef_la_tet(
"eeyoy eye eye capn");
449 mssr_boef_la_tet.substring(chunky, 2, 7);
453 ASSERT_TRUE(george.compare(fred, 0, 0, george.length() - 1,
true),
"did not work");
454 ASSERT_TRUE(george.compare(fred, 8, 8, george.length() - 1 - 8,
true),
"partial did not work");
456 astring taco1(
"iLikeTacosNSuch");
457 astring taco2(
"iLikeTaCosNSuch");
458 ASSERT_TRUE(taco1.compare(taco2, 0, 0, taco1.length() - 1,
false),
459 "tacos case-insensitive compare A did not work");
460 ASSERT_FALSE(taco1.compare(taco2, 0, 0, taco1.length() - 1,
true),
461 "tacos case-sensitive compare B did not work");
463 ASSERT_EQUAL(george.length(),
int(strlen(george.s())),
"length is incorrect (c).");
465 #ifdef DEBUG_STRING_TEST
471 ASSERT_TRUE(george.compare(fred_part, 0, 0, 13,
true),
"did not work");
472 fred_part = fred.
substring(23, fred.length() - 1);
474 ASSERT_TRUE(george.compare(fred_part, 14, 0, fred_part.
length() - 1,
true),
"did not work");
475 #ifdef DEBUG_STRING_TEST
476 LOG(
"compares okay");
480 void test_string::run_test_11()
485 ASSERT_TRUE(!empty,
"not on empty string doesn't work");
487 ASSERT_TRUE(non_empty.length(),
"non-empty string judged empty");
488 ASSERT_FALSE(!non_empty,
"not on non-empty string doesn't work");
491 void test_string::run_test_12()
494 astring elf0(astring::SPRINTF,
"%%_%%_%%");
495 ASSERT_FALSE(strcmp(elf0.s(),
"%_%_%"),
"failed %% printing");
497 char fred[6] = {
'h',
'y',
'a',
'r',
'g',
'\0' };
498 astring fred_copy(astring::UNTERMINATED, fred, 5);
499 ASSERT_EQUAL(fred_copy.length(), 5,
"length of copy is wrong");
502 char hugh[6] = {
'o',
'y',
'o',
'b',
'o',
'y' };
503 astring hugh_copy(astring::UNTERMINATED, hugh, 3);
504 ASSERT_EQUAL(hugh_copy.length(), 3,
"length of copy is wrong");
508 another_copy.
reset(astring::UNTERMINATED, fred, strlen(fred));
513 void test_string::run_test_13()
517 const astring churg(
"borjh sjh oiweoklj");
519 astring flug =
"kase iqk aksjir kljasdo";
520 const char *nerf =
"ausd qwoeui sof zjh qwei";
528 void test_string::run_test_14()
532 const int longish_size = 5000;
533 char temp[longish_size];
534 for (
int i = 0; i < longish_size; i++)
536 temp[longish_size - 1] =
'\0';
537 a_sprintf longish(
"this is a really darned long string of stuff: %s,\nbut doesn't it look interesting?", temp);
539 longish.zap(longish.length() / 3, 2 * longish.length() / 3);
541 ASSERT_EQUAL(longish.length(),
int(strlen(longish.s())),
"length is incorrect.");
544 void test_string::run_test_15()
549 astring testy(astring::SPRINTF,
"%d", try_1);
550 ASSERT_INEQUAL(testy.convert(95), 95,
"default value returned, so it failed.");
551 ASSERT_EQUAL(testy.convert(95), try_1,
"correct value was not returned.");
553 long try_2 = 2938754L;
554 testy =
astring(astring::SPRINTF,
"%ld", try_2);
555 ASSERT_INEQUAL((
double)testy.convert(98L), (
double)98L,
"default value returned, so it failed.");
556 ASSERT_EQUAL((
double)testy.convert(98L), (
double)try_2,
"correct value was not returned.");
558 testy =
astring(astring::SPRINTF,
"%ld", try_2);
559 ASSERT_INEQUAL((
double)testy.convert(98L), (
double)98L,
"default value returned, so it failed.");
560 ASSERT_EQUAL((
double)testy.convert(98L), (
double)try_2,
"correct value was not returned.");
562 float try_3 = float(2938.754);
563 testy =
astring(astring::SPRINTF,
"%f", try_3);
564 float found = testy.convert(
float(98.6));
565 ASSERT_INEQUAL(found, 98.6,
"default value returned, so it failed.");
566 ASSERT_EQUAL(found, try_3,
"correct value was not returned.");
569 double try_4 = 25598437.712385;
570 testy =
astring(astring::SPRINTF,
"%f", try_4);
571 double found2 = testy.convert(
double(98.6));
572 ASSERT_INEQUAL(found2, 98.6,
"default value returned, so it failed.");
573 ASSERT_EQUAL(found2, try_4,
"correct value was not returned.");
577 double try_4 = 25598437.712385e38;
578 testy =
astring(astring::SPRINTF,
"%f", try_4);
579 double found2 = testy.convert(
double(98.6));
580 ASSERT_INEQUAL(found2, 98.6,
"default value returned, so it failed.");
581 ASSERT_EQUAL(found2, try_4,
"correct value was not returned.");
585 void test_string::run_test_16()
590 for (
int i = -3; i < 25; i++) gorf[i] =
't';
592 ASSERT_EQUAL(gorf.length(), 3,
"length is incorrect (a).");
593 gorf.insert(3,
astring(
"bru"));
595 ASSERT_EQUAL(gorf.length(), 6,
"length is incorrect (b).");
596 gorf.insert(35,
astring(
"snu"));
598 ASSERT_EQUAL(gorf.length(), 6,
"length is incorrect (c).");
599 gorf.insert(-30,
astring(
"eep"));
601 ASSERT_EQUAL(gorf.length(), 6,
"length is incorrect (d).");
604 void test_string::run_test_17()
615 void test_string::run_test_18()
617 #ifdef DEBUG_STRING_TEST
626 astring libname = rc_string(IDS_BASIS_NAME);
628 astring(
"library name is a mismatch: comes out as \"") + libname +
"\".");
629 #define IDS_SOME_BAD_UNKNOWN_STRING_HANDLE 30802
630 astring bogus_name = rc_string(IDS_SOME_BAD_UNKNOWN_STRING_HANDLE);
638 #ifdef DEBUG_STRING_TEST
639 LOG(
astring(
"cstringy conversions: ") + george);
640 LOG((
const char *)hal);
648 void test_string::run_test_19()
652 astring problematic_example(astring::SPRINTF,
"this should have %d% more "
653 "stuffing than before!", 20);
655 ASSERT_EQUAL(problematic_example,
astring(
"this should have 20% more stuffing than before!"),
"failure to print correct phrase");
658 void test_string::run_test_20()
660 #ifdef DEBUG_STRING_TEST
666 char myText[] =
"OK";
667 astring myString(astring::SPRINTF,
"%04s", myText);
668 #ifdef DEBUG_STRING_TEST
672 char myText8[] =
"OK";
674 sprintf(my_text_4,
"%4s", myText8);
675 #ifdef DEBUG_STRING_TEST
681 char myText2[] =
"OK";
683 sprintf(myText3,
"%4s", myText2);
685 #ifdef DEBUG_STRING_TEST
690 void test_string::run_test_21()
705 astring placemat(
"mary had a red hooded cobra she kept around her neck "
706 "and it hissed at the people as they walked by her tent.");
707 ASSERT_TRUE(placemat.replace(
"had",
"bought"),
"replace failed");
708 ASSERT_TRUE(!placemat.replace(
"hoded",
"bought"),
"replace didn't fail but should have");
709 ASSERT_TRUE(placemat.replace(
"she",
"funkateria"),
"replace failed");
710 ASSERT_TRUE(placemat.replace(
"hooded",
"hood"),
"replace failed");
711 ASSERT_TRUE(placemat.replace(
"cobra",
"in the"),
"replace failed");
713 int indy = placemat.find(
"kept");
715 placemat[indy - 1] =
'.';
716 placemat.zap(indy, placemat.end());
717 ASSERT_EQUAL(placemat,
astring(
"mary bought a red hood in the funkateria."),
"got wrong result string");
720 void test_string::run_test_22()
738 int x = B.find(
"z*");
751 void test_string::run_test_23()
755 astring strip_string(
"!@#$%^&*()");
757 astring no_stripper(
"this shouldn't change");
758 no_stripper.strip(strip_string, astring::FROM_BOTH_SIDES);
759 ASSERT_EQUAL(no_stripper,
astring(
"this shouldn't change"),
"first test failed comparison");
761 astring strippee_orig(
"&$(*(@&@*()()!()@*(@(*fudge#((@(*@**#)(@#)(#");
762 astring strippee(strippee_orig);
763 strippee.strip(strip_string, astring::FROM_BOTH_SIDES);
766 strippee = strippee_orig;
767 strippee.strip(strip_string, astring::FROM_FRONT);
770 strippee = strippee_orig;
771 strippee.strip(strip_string, astring::FROM_END);
772 ASSERT_EQUAL(strippee,
astring(
"&$(*(@&@*()()!()@*(@(*fudge"),
"fourth test failed comparison");
775 void test_string::run_test_24()
778 #ifndef __GNU_WINDOWS__
781 _bstr_t beast(
"abcdefgh");
782 #ifdef DEBUG_STRING_TEST
783 LOG(
astring(
"the beast is ") + beast.operator
char *() +
784 astring(astring::SPRINTF,
" with length %d", beast.length()));
787 #ifdef DEBUG_STRING_TEST
789 +
astring(astring::SPRINTF,
" with length %d",
convert.length()));
793 astring jethro(
"i want a hog sandwich");
794 _bstr_t pork = string_convert::to_bstr_t(jethro);
795 ASSERT_FALSE(strcmp(pork.operator
char *(), jethro.s()),
"second test failed comparison");
800 void test_string::run_test_25()
807 ASSERT_EQUAL(fred, bub,
"second test failed comparison");
813 void test_string::run_test_26()
818 astring t2 = time_stamp::notarize(
false);
819 astring t4 = time_stamp::notarize(
true);
822 void test_string::run_test_27()
835 void test_string::run_test_28()
842 astring testy(astring::SPRINTF,
"%u:%hu:%c", in1, in2, in3);
846 void test_string::run_test_29()
850 astring a(
"would an onion smell so sweet?");
856 a =
"128 salamanders cannot be wrong.";
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 void test_string::run_test_30()
882 astring parm_string = string_manipulation::make_random_name(40, 140);
883 astring print_into(
' ', 20000);
884 print_into[0] =
'\0';
889 char test_same[20010];
890 sprintf(test_same,
"%d %ld %u %hu %s", i1, l1, u1, s1, parm_string.
s());
891 print_into.sprintf(
"%d %ld %u %hu %s", i1, l1, u1, s1, parm_string.
s());
892 ASSERT_EQUAL(
astring(test_same), print_into,
"sprintf should get same results as standard");
894 print_into.sprintf(
"%c %d %c %s %s %lu",
char(
rando.
inclusive(
'a',
'z')),
899 void test_string::run_test_31()
914 void test_string::run_test_32()
919 const int CHUNK_SIZE = 2 *
MEGABYTE;
922 const int MIN_ADDITION = 10000;
const int MAX_ADDITION = 80000;
924 const int BUILD_AND_BURN_ITERATIONS = 1;
933 for (
int iters = 0; iters < BUILD_AND_BURN_ITERATIONS; iters++) {
938 while (slab.
length() < CHUNK_SIZE - MAX_ADDITION - 20) {
940 astring addition = string_manipulation::make_random_name(MIN_ADDITION,
943 size += addition.
length();
953 int range_length = zap_end - zap_start + 1;
955 slab.
zap(zap_start, zap_end);
956 size -= range_length;
962 void test_string::run_test_33()
967 astring to_modify(
"\\\\feeby\\path\\yo");
968 ASSERT_TRUE(to_modify.replace(
"\\",
"/"),
"failed to replace the string");
970 while (to_modify.replace(
"\\",
"/")) {}
974 astring to_modify(
"\\superduper\\dynamo\\looper");
975 ASSERT_TRUE(to_modify.replace(
"\\",
"/"),
"failed to replace the string");
976 ASSERT_EQUAL(to_modify,
astring(
"/superduper\\dynamo\\looper"),
"produced wrong resultant string");
977 while (to_modify.replace(
"\\",
"/")) {}
978 ASSERT_EQUAL(to_modify,
astring(
"/superduper/dynamo/looper"),
"produced wrong final string");
983 while (id1.
replace(
"/",
" ")) {}
989 while (id2.
replace(
"=",
":")) {}
996 void test_string::run_test_34()
1004 void test_string::run_test_35()
1009 ASSERT_EQUAL(termo.length(), 2812,
"length should be as requested");
1012 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()));
1017 void test_string::run_test_36()
1025 torpid +=
"petunia";
1026 torpid +=
"dumptruck";
1029 sacral +=
"gumboat";
1033 paknid +=
"gorboochy";
1034 paknid +=
"rangolent";
1043 stongent +=
"pemulack";
1044 stongent +=
"bluzzent";
1045 stongent +=
"crupto";
1046 stongent +=
"floonack";
1047 stongent +=
"atoona";
1056 void test_string::run_test_37()
1061 astring a(
"would an onion smell so sweet?");
1067 a =
"128 salamanders cannot be wrong.";
1073 void test_string::run_test_38()
1076 double to_print = 2.345;
1080 to_print = 1.797E+254;
1085 sprintf(
bucket,
"%.1f", to_print);
1092 void test_string::run_test_39()
1095 const char *find_set =
"!?.;";
1096 astring test_1 =
"how do i get to balthazar square? it stinks!";
1102 void test_string::run_test_40()
1106 #define test_name() a_sprintf("test %d: ", test_num)
1140 astring target =
"suzzle rumpetzzes gnargle rezztor";
1156 astring target =
"glorg snorp pendle funk";
1165 void test_string::run_test_41()
1169 #define test_name() a_sprintf("test %d: ", test_num)
1173 const char *finding1 =
"ab";
1175 const char *finding2 =
"xb";
1177 const char *finding3 =
"c";
1180 test_name() +
"wrong answer for test D");
1184 astring target =
"abcadefghoota";
1185 const char *finding1 =
"bcdfghot";
1198 void test_string::run_test_42()
1202 astring hobnob(
"all the best robots are bending robots");
1205 ASSERT_EQUAL(hobnob.right(10),
astring(
"ing robots"),
"failed to find right side of string");
1211 int test_string::execute()
1216 ASSERT_EQUAL(1, 1,
"non-fake assertion to test jenkins log parsing");
1227 #ifdef DEBUG_STRING_TEST
1228 LOG(
astring(astring::SPRINTF,
"index %d", i));
1276 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 strip_spaces(how_to_strip way=FROM_BOTH_SIDES)
removes excess space characters from string's beginning, end or both.
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.