summaryrefslogtreecommitdiff
path: root/innobase/dyn/ts
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/dyn/ts')
-rw-r--r--innobase/dyn/ts/makefile12
-rw-r--r--innobase/dyn/ts/tsdyn.c57
2 files changed, 69 insertions, 0 deletions
diff --git a/innobase/dyn/ts/makefile b/innobase/dyn/ts/makefile
new file mode 100644
index 00000000000..b4b5ad5eadf
--- /dev/null
+++ b/innobase/dyn/ts/makefile
@@ -0,0 +1,12 @@
+
+include ..\..\makefile.i
+
+tsdyn: ..\dyn.lib tsdyn.c makefile
+ $(CCOM) $(CFL) -I.. -I..\.. ..\dyn.lib ..\..\mem.lib ..\..\ut.lib ..\..\mach.lib ..\..\sync.lib ..\..\os.lib tsdyn.c $(LFL)
+
+
+
+
+
+
+
diff --git a/innobase/dyn/ts/tsdyn.c b/innobase/dyn/ts/tsdyn.c
new file mode 100644
index 00000000000..4c21583d9d8
--- /dev/null
+++ b/innobase/dyn/ts/tsdyn.c
@@ -0,0 +1,57 @@
+/************************************************************************
+The test module for dynamic array
+
+(c) 1996 Innobase Oy
+
+Created 2/5/1996 Heikki Tuuri
+*************************************************************************/
+
+#include "../dyn0dyn.h"
+#include "sync0sync.h"
+#include "mem0mem.h"
+
+/****************************************************************
+Basic test. */
+
+void
+test1(void)
+/*=======*/
+{
+ dyn_array_t dyn;
+ ulint i;
+ ulint* ulint_ptr;
+
+ printf("-------------------------------------------\n");
+ printf("TEST 1. Basic test\n");
+
+ dyn_array_create(&dyn);
+
+ for (i = 0; i < 1000; i++) {
+ ulint_ptr = dyn_array_push(&dyn, sizeof(ulint));
+ *ulint_ptr = i;
+ }
+
+ ut_a(dyn_array_get_n_elements(&dyn) == 1000);
+
+ for (i = 0; i < 1000; i++) {
+ ulint_ptr = dyn_array_get_nth_element(&dyn, i, sizeof(ulint));
+ ut_a(*ulint_ptr == i);
+ }
+
+ dyn_array_free(&dyn);
+}
+
+void
+main(void)
+{
+ sync_init();
+ mem_init();
+
+ test1();
+
+ ut_ad(sync_all_freed());
+
+ ut_ad(mem_all_freed());
+
+ printf("TEST SUCCESSFULLY COMPLETED!\n");
+}