about summary refs log tree commit diff stats
path: root/cpp/002main.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-02-16 15:27:02 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-02-16 15:27:49 -0800
commit88663269262e882f63df23ea0ce93f3e95d74a2c (patch)
treeba16f4022e8c50d597972d3596932feed0232046 /cpp/002main.cc
parentf42a8ddc38ec6438c70f7ad5a2b3db3e29280f8e (diff)
downloadmu-88663269262e882f63df23ea0ce93f3e95d74a2c.tar.gz
763 - start of C++ version
Diffstat (limited to 'cpp/002main.cc')
-rw-r--r--cpp/002main.cc56
1 files changed, 56 insertions, 0 deletions
diff --git a/cpp/002main.cc b/cpp/002main.cc
new file mode 100644
index 00000000..2f9e614c
--- /dev/null
+++ b/cpp/002main.cc
@@ -0,0 +1,56 @@
+int main(int argc, const char* argv[]) {
+  if (argc == 2 && string(argv[1]) == "test") {
+    run_tests();
+    return 0;
+  }
+
+  for (int i = 1; i < argc; ++i) {
+    load(argv[i]);
+  }
+  run("main");
+}
+
+void load(const char* filename) {
+}
+
+void run(const char* function_name) {
+}
+
+
+
+//// test harness
+
+void run_tests() {
+  for (unsigned long i=0; i < sizeof(Tests)/sizeof(Tests[0]); ++i) {
+    START_TRACING_UNTIL_END_OF_SCOPE;
+    setup();
+    CLEAR_TRACE;
+    (*Tests[i])();
+    verify();
+  }
+  cerr << '\n';
+  if (Num_failures > 0)
+    cerr << Num_failures << " failure"
+         << (Num_failures > 1 ? "s" : "")
+         << '\n';
+}
+
+void verify() {
+  if (!Passed)
+    ;
+  else
+    cerr << ".";
+}
+
+void setup() {
+  Passed = true;
+}
+
+string time_string() {
+  time_t t;
+  time(&t);
+  char buffer[10];
+  if (!strftime(buffer, 10, "%H:%M:%S", localtime(&t)))
+    return "";
+  return buffer;
+}