Added hash table tests.
Added hash table tests.
1.1 --- a/include/am-string.h Mon Aug 26 23:18:03 2013 -0700
1.2 +++ b/include/am-string.h Tue Aug 27 00:49:33 2013 -0700
1.3 @@ -81,6 +81,9 @@
1.4 return *this;
1.5 }
1.6
1.7 + int compare(const char *str) const {
1.8 + return strcmp(chars(), str);
1.9 + }
1.10 int compare(const AString &other) const {
1.11 return strcmp(chars(), other.chars());
1.12 }
2.1 --- a/tests/AMBuild.tests Mon Aug 26 23:18:03 2013 -0700
2.2 +++ b/tests/AMBuild.tests Tue Aug 27 00:49:33 2013 -0700
2.3 @@ -30,6 +30,7 @@
2.4 binary = Cpp.ExecutableBuilder('testrun', AMBuild, job, compiler)
2.5 files = [
2.6 'main.cpp',
2.7 + 'test-hashmap.cpp',
2.8 'test-inlinelist.cpp',
2.9 'test-linkedlist.cpp',
2.10 'test-vector.cpp',
3.1 --- a/tests/main.cpp Mon Aug 26 23:18:03 2013 -0700
3.2 +++ b/tests/main.cpp Tue Aug 27 00:49:33 2013 -0700
3.3 @@ -30,6 +30,7 @@
3.4 #include <stddef.h>
3.5 #include <stdio.h>
3.6 #include <stdlib.h>
3.7 +#include <string.h>
3.8 #include "runner.h"
3.9
3.10 using namespace ke;
3.11 @@ -40,6 +41,10 @@
3.12 {
3.13 Test *test = Test::first();
3.14 while (test) {
3.15 + if (argc >= 2 && strcmp(argv[1], test->name()) != 0) {
3.16 + test = test->next();
3.17 + continue;
3.18 + }
3.19 fprintf(stdout, "Testing %s... \n", test->name());
3.20 if (!test->Run()) {
3.21 fprintf(stdout, "TEST:%s FAIL\n", test->name());
3.22 @@ -61,8 +66,18 @@
3.23 return malloc(amount);
3.24 }
3.25
3.26 +void *operator new[](size_t amount)
3.27 +{
3.28 + return malloc(amount);
3.29 +}
3.30 +
3.31 void operator delete(void *p)
3.32 {
3.33 free(p);
3.34 }
3.35 +
3.36 +void operator delete[](void *p)
3.37 +{
3.38 + free(p);
3.39 +}
3.40 #endif