diff --git a/tests/debugger/test_pointers.cpp b/tests/debugger/test_pointers.cpp deleted file mode 100644 index 007312b205ee4..0000000000000 --- a/tests/debugger/test_pointers.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2016 The Emscripten Authors. All rights reserved. -// Emscripten is available under two separate licenses, the MIT license and the -// University of Illinois/NCSA Open Source License. Both these licenses can be -// found in the LICENSE file. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct TestBase { - float a; - char b; - char *c; - char *d; - char **e; - char ***f; - short **g; - - // Test a reference - int &h; - TestBase(int& rt) : h(rt) {} -}; - -struct TinyStruct { - short len; - const char * chars; -}; - -struct StructOfStructs { - TestBase *tb; - TinyStruct *ts; -}; - -void test_1() { - int z = 42; - TestBase tb(z); - tb.a = 42.1f; - tb.b = 'b'; - tb.c = nullptr; - - tb.d = static_cast(malloc(10)); - tb.d[0] = 'd'; - - tb.e = static_cast(malloc(sizeof(char*))); - tb.e[0] = static_cast(malloc(sizeof(char))); - tb.e[0][0] = 'e'; - - tb.f = static_cast(malloc(sizeof(char**))); - tb.f[0] = static_cast(malloc(sizeof(char*))); - tb.f[0][0] = static_cast(malloc(sizeof(char))); - tb.f[0][0][0] = 'f'; - - tb.g = static_cast(malloc(sizeof(short*))); - tb.g[0] = static_cast(malloc(sizeof(short))); - tb.g[0][0] = 12345; - - EM_ASM_INT({ - var decoded = Module['cyberdwarf'].decode_from_stack($0, "tb", 100)["struct TestBase"]; - test_assert("Found the answer", decoded["float : a"] - 42 < 1.0); - test_assert("Found 'b'", decoded["char : b"] == 98); - test_assert("Found null", decoded["char * : c"] == "null"); - test_assert("Found 'd'", decoded["char * : d"] == 100); - test_assert("Found 'e'", decoded["char * * : e"] == 101); - test_assert("Found 'f'", decoded["char * * * : f"] == 102); - test_assert("Found simple short", decoded["short * * : g"] == 12345); - test_assert("Found the answer by reference", decoded["int & : h"] == 42); - - }, &tb); - -} - -void test_2() { - StructOfStructs sos; - int z = 50; - sos.tb = new TestBase(z); - sos.tb->a = 1337; - - sos.ts = static_cast(malloc(sizeof(TinyStruct))); - sos.ts->chars = "Hello in there"; - sos.ts->len = strlen(sos.ts->chars); - - EM_ASM_INT({ - var decoded = Module['cyberdwarf'].decode_from_stack($0, "sos", 100)["struct StructOfStructs"]; - test_assert("Found the answer", decoded["struct TestBase * : tb"]["float : a"] == 1337); - }, &sos); - -} - - -int main(int argc, char *argv[]) { - EM_ASM(init_cd_test("test_pointers")); - - test_1(); - test_2(); -} diff --git a/tests/debugger/test_preamble.js b/tests/debugger/test_preamble.js deleted file mode 100644 index 816d3e34c945f..0000000000000 --- a/tests/debugger/test_preamble.js +++ /dev/null @@ -1,15 +0,0 @@ -function init_cd_test(name) { - console.log("-------------- Starting test " + name + " --------------"); - Module['cyberdwarf'].initialize_debugger(); -} - -function TestException(message) { - this.message = message; - this.name = "TestException"; -} - -function test_assert(desc, value) { - if (!value) { - throw new TestException("Test case " + desc + " failed!"); - } -} diff --git a/tests/debugger/test_union.cpp b/tests/debugger/test_union.cpp deleted file mode 100644 index 9bf43bfc21fb4..0000000000000 --- a/tests/debugger/test_union.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2016 The Emscripten Authors. All rights reserved. -// Emscripten is available under two separate licenses, the MIT license and the -// University of Illinois/NCSA Open Source License. Both these licenses can be -// found in the LICENSE file. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -union TestBase { - char c; - int i; - float f; -}; - - -// Keep in mind that it is undefined behavior to read from the non active member of a union in C++ -// Don't add tests that assign to 1 member but check another -void test_1() { - TestBase tb; - tb.c = 11; - - EM_ASM_INT({ - var decoded = Module['cyberdwarf'].decode_from_stack($0, "tb", 100)["union TestBase"]; - test_assert("char == 11", decoded["char : c"] == 11); - }, &tb); - - tb.i = 1337; - - EM_ASM_INT({ - var decoded = Module['cyberdwarf'].decode_from_stack($0, "tb", 100)["union TestBase"]; - test_assert("int == 1337", decoded["int : i"] == 1337); - }, &tb); - - tb.f = 10000; - - EM_ASM_INT({ - var decoded = Module['cyberdwarf'].decode_from_stack($0, "tb", 100)["union TestBase"]; - test_assert("float == 10000", decoded["float : f"] == 10000); - }, &tb); - - -} - -int main(int argc, char *argv[]) { - EM_ASM(init_cd_test("test_union")); - - test_1(); -} diff --git a/tests/test_pystruct.cpp b/tests/test_pystruct.cpp deleted file mode 100644 index 47ee449e7e413..0000000000000 --- a/tests/test_pystruct.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2016 The Emscripten Authors. All rights reserved. - * Emscripten is available under two separate licenses, the MIT license and the - * University of Illinois/NCSA Open Source License. Both these licenses can be - * found in the LICENSE file. - */ - -#include - -// Based on CPython code -union PyGC_Head { - struct { - union PyGC_Head *gc_next; - union PyGC_Head *gc_prev; - size_t gc_refs; - } gc; - long double dummy; /* force worst-case alignment */ -} ; - -struct gc_generation { - PyGC_Head head; - int threshold; /* collection threshold */ - int count; /* count of allocations or collections of younger - generations */ -}; - -#define NUM_GENERATIONS 3 -#define GEN_HEAD(n) (&generations[n].head) - -/* linked lists of container objects */ -static struct gc_generation generations[NUM_GENERATIONS] = { - /* PyGC_Head, threshold, count */ - {{{GEN_HEAD(0), GEN_HEAD(0), 0}}, 700, 0}, - {{{GEN_HEAD(1), GEN_HEAD(1), 0}}, 10, 0}, - {{{GEN_HEAD(2), GEN_HEAD(2), 0}}, 10, 0}, -}; - -int main() -{ - gc_generation *n = NULL; - printf("*%d,%d,%d,%d,%d,%d,%d,%d*\n", - (int)(&n[0]), - (int)(&n[0].head), - (int)(&n[0].head.gc.gc_next), - (int)(&n[0].head.gc.gc_prev), - (int)(&n[0].head.gc.gc_refs), - (int)(&n[0].threshold), (int)(&n[0].count), (int)(&n[1]) - ); - printf("*%d,%d,%d*\n", - (int)(&generations[0]) == - (int)(&generations[0].head.gc.gc_next), - (int)(&generations[0]) == - (int)(&generations[0].head.gc.gc_prev), - (int)(&generations[0]) == - (int)(&generations[1]) - ); - int x1 = (int)(&generations[0]); - int x2 = (int)(&generations[1]); - printf("*%d*\n", x1 == x2); - for (int i = 0; i < NUM_GENERATIONS; i++) { - PyGC_Head *list = GEN_HEAD(i); - printf("%d:%d,%d\n", i, (int)list == (int)(list->gc.gc_prev), (int)list ==(int)(list->gc.gc_next)); - } - printf("*%d,%d,%d*\n", sizeof(PyGC_Head), sizeof(gc_generation), int(GEN_HEAD(2)) - int(GEN_HEAD(1))); -} diff --git a/tests/test_pystruct.out b/tests/test_pystruct.out deleted file mode 100644 index 4f9f57bb23c0b..0000000000000 --- a/tests/test_pystruct.out +++ /dev/null @@ -1,7 +0,0 @@ -*0,0,0,4,8,16,20,24* -*1,0,0* -*0* -0:1,1 -1:1,1 -2:1,1 -*16,24,24*