about summary refs log tree commit diff
path: root/src/rt/test/rust_test_harness.cpp
diff options
context:
space:
mode:
authorEric Holk <eholk@mozilla.com>2011-06-28 12:54:41 -0700
committerGraydon Hoare <graydon@mozilla.com>2011-06-28 16:12:34 -0700
commitf6f8a06d6bf010b8d30c23786976792cccfbd6de (patch)
tree7aeb93091cdb19e6ac3b2a63fd7f828a4b3c1499 /src/rt/test/rust_test_harness.cpp
parent657e5a2bd579f7f1698f8ba88cb1142ced7a477f (diff)
downloadrust-f6f8a06d6bf010b8d30c23786976792cccfbd6de.tar.gz
rust-f6f8a06d6bf010b8d30c23786976792cccfbd6de.zip
Resurrecting the runtime unit tests, and modifying them so they compile under the latest refactoring changes.
Diffstat (limited to 'src/rt/test/rust_test_harness.cpp')
-rw-r--r--src/rt/test/rust_test_harness.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/rt/test/rust_test_harness.cpp b/src/rt/test/rust_test_harness.cpp
new file mode 100644
index 00000000000..cca199dcdb9
--- /dev/null
+++ b/src/rt/test/rust_test_harness.cpp
@@ -0,0 +1,40 @@
+#include "../rust_internal.h"
+
+bool
+rust_test::run() {
+    return false;
+}
+
+const char *
+rust_test::name() {
+    return "untitled";
+}
+
+rust_test_suite::rust_test_suite() {
+    tests.append(new rust_domain_test());
+    tests.append(new rust_task_test(this));
+    tests.append(new rust_array_list_test());
+    tests.append(new rust_synchronized_indexed_list_test());
+}
+
+rust_test_suite::~rust_test_suite() {
+
+}
+
+bool
+rust_test_suite::run() {
+    bool pass = true;
+    for (size_t i = 0; i < tests.size(); i++) {
+        rust_test *test = tests[i];
+        printf("test: %s running ... \n", test->name());
+        timer timer;
+        bool result = tests[i]->run();
+        printf("test: %s %s %.2f ms\n", test->name(),
+               result ? "PASSED" : "FAILE", timer.get_elapsed_time_in_ms());
+        if (result == false) {
+            pass = false;
+        }
+    }
+    return pass;
+}
+