Merge "Add testcase for libstdc++ <chrono> for C++0x."
diff --git a/tests/build/test-gnustl-chrono/jni/Android.mk b/tests/build/test-gnustl-chrono/jni/Android.mk
new file mode 100644
index 0000000..8250731
--- /dev/null
+++ b/tests/build/test-gnustl-chrono/jni/Android.mk
@@ -0,0 +1,7 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := test_stl_chrono
+LOCAL_SRC_FILES := main.cpp hanoi.c
+LOCAL_CPPFLAGS := -std=c++0x
+include $(BUILD_EXECUTABLE)
diff --git a/tests/build/test-gnustl-chrono/jni/Application.mk b/tests/build/test-gnustl-chrono/jni/Application.mk
new file mode 100644
index 0000000..e235f0d
--- /dev/null
+++ b/tests/build/test-gnustl-chrono/jni/Application.mk
@@ -0,0 +1,2 @@
+APP_STL := gnustl_static
+APP_ABI := all
diff --git a/tests/build/test-gnustl-chrono/jni/hanoi.c b/tests/build/test-gnustl-chrono/jni/hanoi.c
new file mode 100644
index 0000000..3183751
--- /dev/null
+++ b/tests/build/test-gnustl-chrono/jni/hanoi.c
@@ -0,0 +1,11 @@
+#include "hanoi.h"
+
+void hanoi(int from, int to, int mid, int n, void (*callback)(int, int)) {
+  if (n == 1) {
+    callback(from, to);
+  } else {
+    hanoi(from, mid, to, n - 1, callback);
+    callback(from, to);
+    hanoi(mid, to, from, n - 1, callback);
+  }
+}
diff --git a/tests/build/test-gnustl-chrono/jni/hanoi.h b/tests/build/test-gnustl-chrono/jni/hanoi.h
new file mode 100644
index 0000000..0b593f4
--- /dev/null
+++ b/tests/build/test-gnustl-chrono/jni/hanoi.h
@@ -0,0 +1,15 @@
+#ifndef HANOI_H
+#define HANOI_H
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+extern void hanoi(int from, int to, int mid, int n,
+                  void (*callback)(int, int));
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* HANOI_H */
diff --git a/tests/build/test-gnustl-chrono/jni/main.cpp b/tests/build/test-gnustl-chrono/jni/main.cpp
new file mode 100644
index 0000000..92f352f
--- /dev/null
+++ b/tests/build/test-gnustl-chrono/jni/main.cpp
@@ -0,0 +1,22 @@
+#include <chrono>
+#include <cstdio>
+
+#include "hanoi.h"
+
+using namespace std;
+using namespace std::chrono;
+
+void hanoi_callback(int from, int to) {
+}
+
+int main()
+{
+  high_resolution_clock::time_point start = high_resolution_clock::now();
+  hanoi(0, 2, 1, 25, &hanoi_callback);
+  high_resolution_clock::time_point end = high_resolution_clock::now();
+
+  printf("Duration: %lld ns\n",
+    static_cast<long long>(duration_cast<nanoseconds>(end - start).count()));
+
+  return 0;
+}