aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cmake/target_html/CMakeLists.txt32
-rw-r--r--tests/core/test_atomic_cxx.cpp34
-rw-r--r--tests/core/test_atomic_cxx.txt52
-rw-r--r--tests/core/test_polymorph.in8
-rw-r--r--tests/core/test_polymorph.out4
-rw-r--r--tests/embind/embind.test.js6
-rw-r--r--tests/embind/embind_test.cpp54
-rw-r--r--tests/fuzz/19.c1408
-rw-r--r--tests/fuzz/19.c.txt1
-rw-r--r--tests/sdl_touch.c81
-rw-r--r--tests/test_browser.py5
-rw-r--r--tests/test_core.py24
-rw-r--r--tests/test_interactive.py3
-rw-r--r--tests/test_other.py32
-rw-r--r--tests/webidl/output.txt56
-rw-r--r--tests/webidl/post.js117
-rw-r--r--tests/webidl/test.cpp8
-rw-r--r--tests/webidl/test.h72
-rw-r--r--tests/webidl/test.idl64
19 files changed, 1987 insertions, 74 deletions
diff --git a/tests/cmake/target_html/CMakeLists.txt b/tests/cmake/target_html/CMakeLists.txt
index b5c69417..ce26c541 100644
--- a/tests/cmake/target_html/CMakeLists.txt
+++ b/tests/cmake/target_html/CMakeLists.txt
@@ -10,6 +10,38 @@ else() # Either MinSizeRel, RelWithDebInfo or Release, all which run with optimi
SET(linkFlags "-O2")
endif()
+if (NOT CMAKE_AR OR NOT EXISTS "${CMAKE_AR}")
+ message(FATAL_ERROR "CMAKE_AR='${CMAKE_AR}' does not exist for Emscripten toolchain!")
+endif()
+
+if (NOT CMAKE_RANLIB OR NOT EXISTS "${CMAKE_RANLIB}")
+ message(FATAL_ERROR "CMAKE_RANLIB='${CMAKE_RANLIB}' does not exist for Emscripten toolchain!")
+endif()
+
+if (NOT CMAKE_C_COMPILER OR NOT EXISTS "${CMAKE_C_COMPILER}")
+ message(FATAL_ERROR "CMAKE_C_COMPILER='${CMAKE_C_COMPILER}' does not exist for Emscripten toolchain!")
+endif()
+
+if (NOT CMAKE_CXX_COMPILER OR NOT EXISTS "${CMAKE_CXX_COMPILER}")
+ message(FATAL_ERROR "CMAKE_CXX_COMPILER='${CMAKE_CXX_COMPILER}' does not exist for Emscripten toolchain!")
+endif()
+
+if (WIN32)
+ message(FATAL_ERROR "WIN32 should not be defined when cross-compiling!")
+endif()
+
+if (APPLE)
+ message(FATAL_ERROR "APPLE should not be defined when cross-compiling!")
+endif()
+
+if (NOT EMSCRIPTEN)
+ message(FATAL_ERROR "EMSCRIPTEN should be defined when cross-compiling!")
+endif()
+
+if (NOT CMAKE_C_SIZEOF_DATA_PTR)
+ message(FATAL_ERROR "CMAKE_C_SIZEOF_DATA_PTR was not defined!")
+endif()
+
SET(CMAKE_EXECUTABLE_SUFFIX ".html")
add_executable(hello_world_gles ${sourceFiles})
diff --git a/tests/core/test_atomic_cxx.cpp b/tests/core/test_atomic_cxx.cpp
index e347c34a..f78922a1 100644
--- a/tests/core/test_atomic_cxx.cpp
+++ b/tests/core/test_atomic_cxx.cpp
@@ -8,7 +8,7 @@
#include <atomic>
#include <cstdio>
-template<typename TYPE> void test(TYPE mask0, TYPE mask1, TYPE mask2) {
+template<typename TYPE, typename UNSIGNED_TYPE> void test(TYPE mask0, TYPE mask1, TYPE mask2) {
typedef TYPE dog;
const TYPE numMemoryOrders = 6;
@@ -54,54 +54,54 @@ template<typename TYPE> void test(TYPE mask0, TYPE mask1, TYPE mask2) {
atomicDog = 0;
for (TYPE i = 0; i < numMemoryOrders; i++) {
TYPE old = atomicDog.fetch_add(1, memoryOrder[i]);
- printf("fetch_add %lld: old=%lld new=%lld\n", (long long)i, (long long)old, TYPE(atomicDog));
+ printf("fetch_add %lld: old=%lld new=%lld\n", (long long)i, (long long)old, (long long)TYPE(atomicDog));
}
// fetch_sub
for (TYPE i = 0; i < numMemoryOrders; i++) {
TYPE old = atomicDog.fetch_sub(1, memoryOrder[i]);
- printf("fetch_sub %lld: old=%lld new=%lld\n", (long long)i, (long long)old, TYPE(atomicDog));
+ printf("fetch_sub %lld: old=%lld new=%lld\n", (long long)i, (long long)old, (long long)TYPE(atomicDog));
}
// fetch_and
for (TYPE i = 0; i < numMemoryOrders; i++) {
atomicDog.store(mask0, memoryOrder[i]);
TYPE old = atomicDog.fetch_and((1<<i), memoryOrder[i]);
- printf("fetch_and %lld: old=%llx, new=%llx\n", (long long)i, (long long)old, TYPE(atomicDog));
+ printf("fetch_and %lld: old=%llx, new=%llx\n", (long long)i, (unsigned long long)UNSIGNED_TYPE(old), (unsigned long long)UNSIGNED_TYPE(atomicDog));
}
// fetch_or
atomicDog = 0;
for (TYPE i = 0; i < numMemoryOrders; i++) {
TYPE old = atomicDog.fetch_or((1<<i), memoryOrder[i]);
- printf("fetch_or %lld: old=%llx, new=%llx\n", (long long)i, (long long)old, TYPE(atomicDog));
+ printf("fetch_or %lld: old=%llx, new=%llx\n", (long long)i, (unsigned long long)UNSIGNED_TYPE(old), (unsigned long long)UNSIGNED_TYPE(atomicDog));
}
// fetch_xor
atomicDog = 0;
for (int i = 0; i < numMemoryOrders; i++) {
int old = atomicDog.fetch_xor((1<<i), memoryOrder[i]);
- printf("fetch_xor %lld: old=%llx, new=%llx\n", (long long)i, (long long)old, TYPE(atomicDog));
+ printf("fetch_xor %lld: old=%llx, new=%llx\n", (long long)i, (unsigned long long)UNSIGNED_TYPE(old), (unsigned long long)UNSIGNED_TYPE(atomicDog));
}
// operator++, --
atomicDog = 0;
atomicDog++;
- printf("operator++: %lld\n", TYPE(atomicDog));
+ printf("operator++: %lld\n", (long long)TYPE(atomicDog));
atomicDog--;
- printf("operator--: %lld\n", TYPE(atomicDog));
+ printf("operator--: %lld\n", (long long)TYPE(atomicDog));
// operator +=, -=, &=, |=, ^=
atomicDog += 10;
- printf("operator+=: %lld\n", TYPE(atomicDog));
+ printf("operator+=: %lld\n", (long long)TYPE(atomicDog));
atomicDog -= 5;
- printf("operator-=: %lld\n", TYPE(atomicDog));
+ printf("operator-=: %lld\n", (long long)TYPE(atomicDog));
atomicDog |= mask0;
- printf("operator|=: %llx\n", TYPE(atomicDog));
+ printf("operator|=: %llx\n", (unsigned long long)UNSIGNED_TYPE(atomicDog));
atomicDog &= mask1;
- printf("operator|=: %llx\n", TYPE(atomicDog));
+ printf("operator&=: %llx\n", (unsigned long long)UNSIGNED_TYPE(atomicDog));
atomicDog ^= mask2;
- printf("operator^=: %llx\n", TYPE(atomicDog));
+ printf("operator^=: %llx\n", (unsigned long long)UNSIGNED_TYPE(atomicDog));
}
@@ -109,13 +109,13 @@ int main() {
// test 8, 16, 32 and 64-bit data types
printf("\n8 bits\n\n");
- test<char>(0xFF, 0xF0, 0x0F);
+ test<char, unsigned char>(0xFF, 0xF0, 0x0F);
printf("\n16 bits\n\n");
- test<short>(0xFFFF, 0xF0F0, 0x0F0F);
+ test<short, unsigned short>(0xFFFF, 0xF0F0, 0x0F0F);
printf("\n32 bits\n\n");
- test<int>(0xFFFFFFFF, 0xF0F0F0F0, 0x0F0F0F0F);
+ test<int, unsigned int>(0xFFFFFFFF, 0xF0F0F0F0, 0x0F0F0F0F);
printf("\n64 bits\n\n");
- test<long long>(0xFFFFFFFFFFFFFFFF, 0xF0F0F0F0F0F0F0F0, 0x0F0F0F0F0F0F0F0F);
+ test<long long, unsigned long long>(0xFFFFFFFFFFFFFFFF, 0xF0F0F0F0F0F0F0F0, 0x0F0F0F0F0F0F0F0F);
// test atomic_flag (should also have memory_orders, but probably doesn't matter
// to find the missing atomic functions)
diff --git a/tests/core/test_atomic_cxx.txt b/tests/core/test_atomic_cxx.txt
index e0beb498..da437b57 100644
--- a/tests/core/test_atomic_cxx.txt
+++ b/tests/core/test_atomic_cxx.txt
@@ -29,12 +29,12 @@ fetch_sub 2: old=4 new=3
fetch_sub 3: old=3 new=2
fetch_sub 4: old=2 new=1
fetch_sub 5: old=1 new=0
-fetch_and 0: old=ffffffffffffffff, new=1
-fetch_and 1: old=ffffffffffffffff, new=2
-fetch_and 2: old=ffffffffffffffff, new=4
-fetch_and 3: old=ffffffffffffffff, new=8
-fetch_and 4: old=ffffffffffffffff, new=10
-fetch_and 5: old=ffffffffffffffff, new=20
+fetch_and 0: old=ff, new=1
+fetch_and 1: old=ff, new=2
+fetch_and 2: old=ff, new=4
+fetch_and 3: old=ff, new=8
+fetch_and 4: old=ff, new=10
+fetch_and 5: old=ff, new=20
fetch_or 0: old=0, new=1
fetch_or 1: old=1, new=3
fetch_or 2: old=3, new=7
@@ -51,9 +51,9 @@ operator++: 1
operator--: 0
operator+=: 10
operator-=: 5
-operator|=: ffffffff
-operator|=: fffffff0
-operator^=: ffffffff
+operator|=: ff
+operator&=: f0
+operator^=: ff
16 bits
@@ -85,12 +85,12 @@ fetch_sub 2: old=4 new=3
fetch_sub 3: old=3 new=2
fetch_sub 4: old=2 new=1
fetch_sub 5: old=1 new=0
-fetch_and 0: old=ffffffffffffffff, new=1
-fetch_and 1: old=ffffffffffffffff, new=2
-fetch_and 2: old=ffffffffffffffff, new=4
-fetch_and 3: old=ffffffffffffffff, new=8
-fetch_and 4: old=ffffffffffffffff, new=10
-fetch_and 5: old=ffffffffffffffff, new=20
+fetch_and 0: old=ffff, new=1
+fetch_and 1: old=ffff, new=2
+fetch_and 2: old=ffff, new=4
+fetch_and 3: old=ffff, new=8
+fetch_and 4: old=ffff, new=10
+fetch_and 5: old=ffff, new=20
fetch_or 0: old=0, new=1
fetch_or 1: old=1, new=3
fetch_or 2: old=3, new=7
@@ -107,9 +107,9 @@ operator++: 1
operator--: 0
operator+=: 10
operator-=: 5
-operator|=: ffffffff
-operator|=: fffff0f0
-operator^=: ffffffff
+operator|=: ffff
+operator&=: f0f0
+operator^=: ffff
32 bits
@@ -141,12 +141,12 @@ fetch_sub 2: old=4 new=3
fetch_sub 3: old=3 new=2
fetch_sub 4: old=2 new=1
fetch_sub 5: old=1 new=0
-fetch_and 0: old=ffffffffffffffff, new=1
-fetch_and 1: old=ffffffffffffffff, new=2
-fetch_and 2: old=ffffffffffffffff, new=4
-fetch_and 3: old=ffffffffffffffff, new=8
-fetch_and 4: old=ffffffffffffffff, new=10
-fetch_and 5: old=ffffffffffffffff, new=20
+fetch_and 0: old=ffffffff, new=1
+fetch_and 1: old=ffffffff, new=2
+fetch_and 2: old=ffffffff, new=4
+fetch_and 3: old=ffffffff, new=8
+fetch_and 4: old=ffffffff, new=10
+fetch_and 5: old=ffffffff, new=20
fetch_or 0: old=0, new=1
fetch_or 1: old=1, new=3
fetch_or 2: old=3, new=7
@@ -164,7 +164,7 @@ operator--: 0
operator+=: 10
operator-=: 5
operator|=: ffffffff
-operator|=: f0f0f0f0
+operator&=: f0f0f0f0
operator^=: ffffffff
64 bits
@@ -220,7 +220,7 @@ operator--: 0
operator+=: 10
operator-=: 5
operator|=: ffffffffffffffff
-operator|=: f0f0f0f0f0f0f0f0
+operator&=: f0f0f0f0f0f0f0f0
operator^=: ffffffffffffffff
atomic_flag: false
done.
diff --git a/tests/core/test_polymorph.in b/tests/core/test_polymorph.in
index 1f24a1aa..af07dc05 100644
--- a/tests/core/test_polymorph.in
+++ b/tests/core/test_polymorph.in
@@ -16,6 +16,8 @@ struct Child : Parent {
struct Other {
int one() { return 11; }
int two() { return 22; }
+ virtual int three() { return 33; }
+ virtual int four() { return 44; }
};
int main() {
@@ -24,10 +26,16 @@ int main() {
printf("*%d,%d,%d,%d*\n", x->getit(), y->getit(), x->implme(), y->implme());
Other *o = new Other;
+
int (Other::*Ls)() = &Other::one;
printf("*%d*\n", (o->*(Ls))());
Ls = &Other::two;
printf("*%d*\n", (o->*(Ls))());
+ Ls = &Other::three;
+ printf("*%d*\n", (o->*(Ls))());
+ Ls = &Other::four;
+ printf("*%d*\n", (o->*(Ls))());
+
return 0;
}
diff --git a/tests/core/test_polymorph.out b/tests/core/test_polymorph.out
index 0d036bf0..5163ea8e 100644
--- a/tests/core/test_polymorph.out
+++ b/tests/core/test_polymorph.out
@@ -1,3 +1,5 @@
*11,74,32,1012*
*11*
-*22* \ No newline at end of file
+*22*
+*33*
+*44*
diff --git a/tests/embind/embind.test.js b/tests/embind/embind.test.js
index e2160c33..6bba4de0 100644
--- a/tests/embind/embind.test.js
+++ b/tests/embind/embind.test.js
@@ -1408,7 +1408,7 @@ module({
var e = assert.throws(cm.BindingError, function() {
cm.passThroughCustomSmartPtr(o);
});
- assert.equal('Cannot convert argument of type NSt3__110shared_ptrI20HeldByCustomSmartPtrEE to parameter type 14CustomSmartPtrI20HeldByCustomSmartPtrE', e.message);
+ assert.equal('Cannot convert argument of type shared_ptr<HeldByCustomSmartPtr> to parameter type CustomSmartPtr<HeldByCustomSmartPtr>', e.message);
o.delete();
});
@@ -1646,6 +1646,10 @@ module({
if (typeof INVOKED_FROM_EMSCRIPTEN_TEST_RUNNER === "undefined") { // TODO: Enable this to work in Emscripten runner as well!
BaseFixture.extend("unbound types", function() {
+ if (!cm.hasUnboundTypeNames) {
+ return;
+ }
+
function assertMessage(fn, message) {
var e = assert.throws(cm.UnboundTypeError, fn);
assert.equal(message, e.message);
diff --git a/tests/embind/embind_test.cpp b/tests/embind/embind_test.cpp
index d299660a..1b835751 100644
--- a/tests/embind/embind_test.cpp
+++ b/tests/embind/embind_test.cpp
@@ -1150,8 +1150,8 @@ void callDifferentArguments(AbstractClass& ac, int i, double d, unsigned char f,
EMSCRIPTEN_BINDINGS(interface_tests) {
class_<AbstractClass>("AbstractClass")
- .smart_ptr<std::shared_ptr<AbstractClass>>()
- .allow_subclass<AbstractClassWrapper>()
+ .smart_ptr<std::shared_ptr<AbstractClass>>("shared_ptr<AbstractClass>")
+ .allow_subclass<AbstractClassWrapper>("AbstractClassWrapper")
.function("abstractMethod", &AbstractClass::abstractMethod)
.function("optionalMethod", &AbstractClass::optionalMethod)
;
@@ -1483,7 +1483,7 @@ EMSCRIPTEN_BINDINGS(tests) {
function("emval_test_take_and_return_TupleInStruct", &emval_test_take_and_return_TupleInStruct);
class_<ValHolder>("ValHolder")
- .smart_ptr<std::shared_ptr<ValHolder>>()
+ .smart_ptr<std::shared_ptr<ValHolder>>("std::shared_ptr<ValHolder>")
.constructor<val>()
.function("getVal", &ValHolder::getVal)
.function("getValNonConst", &ValHolder::getValNonConst)
@@ -1522,7 +1522,7 @@ EMSCRIPTEN_BINDINGS(tests) {
function("emval_test_take_and_call_functor", &emval_test_take_and_call_functor);
class_<StringHolder>("StringHolder")
- .smart_ptr<std::shared_ptr<StringHolder>>()
+ .smart_ptr<std::shared_ptr<StringHolder>>("shared_ptr<StringHolder>")
.constructor<std::string>()
.function("set", &StringHolder::set)
.function("get", &StringHolder::get)
@@ -1566,7 +1566,7 @@ EMSCRIPTEN_BINDINGS(tests) {
// register Derived before Base as a test that it's possible to
// register base classes afterwards
class_<Derived, base<Base>>("Derived")
- .smart_ptr<std::shared_ptr<Derived>>()
+ .smart_ptr<std::shared_ptr<Derived>>("shared_ptr<Derived>")
.constructor<>()
.function("getClassName", &Derived::getClassName)
.function("getMember", &Derived::getMember)
@@ -1575,7 +1575,7 @@ EMSCRIPTEN_BINDINGS(tests) {
;
class_<Base>("Base")
- .smart_ptr<std::shared_ptr<Base>>()
+ .smart_ptr<std::shared_ptr<Base>>("shared_ptr<Base")
.constructor<>()
.function("getClassName", &Base::getClassName)
.function("getClassNameFromBase", &Base::getClassNameFromBase)
@@ -1589,7 +1589,7 @@ EMSCRIPTEN_BINDINGS(tests) {
;
class_<SecondBase>("SecondBase")
- .smart_ptr<std::shared_ptr<SecondBase>>()
+ .smart_ptr<std::shared_ptr<SecondBase>>("shared_ptr<SecondBase>")
.constructor<>()
.function("getClassName", &SecondBase::getClassName)
.function("getClassNameFromSecondBase", &SecondBase::getClassNameFromSecondBase)
@@ -1612,13 +1612,13 @@ EMSCRIPTEN_BINDINGS(tests) {
;
class_<SiblingDerived>("SiblingDerived")
- .smart_ptr<std::shared_ptr<SiblingDerived>>()
+ .smart_ptr<std::shared_ptr<SiblingDerived>>("shared_ptr<SiblingDerived>")
.constructor<>()
.function("getClassName", &SiblingDerived::getClassName)
;
class_<MultiplyDerived, base<Base>>("MultiplyDerived")
- .smart_ptr<std::shared_ptr<MultiplyDerived>>()
+ .smart_ptr<std::shared_ptr<MultiplyDerived>>("shared_ptr<MultiplyDerived>")
.constructor<>()
.function("getClassName", &MultiplyDerived::getClassName)
.class_function("getInstanceCount", &MultiplyDerived::getInstanceCount)
@@ -1630,26 +1630,26 @@ EMSCRIPTEN_BINDINGS(tests) {
;
class_<DerivedThrice, base<Derived> >("DerivedThrice")
- .smart_ptr<std::shared_ptr<DerivedThrice>>()
+ .smart_ptr<std::shared_ptr<DerivedThrice>>("shared_ptr<DerivedThrice>")
.constructor<>()
.function("getClassName", &DerivedThrice::getClassName)
;
class_<PolyBase>("PolyBase")
- .smart_ptr<std::shared_ptr<PolyBase>>()
+ .smart_ptr<std::shared_ptr<PolyBase>>("shared_ptr<PolyBase>")
.constructor<>()
.function("virtualGetClassName", &PolyBase::virtualGetClassName)
.function("getClassName", &PolyBase::getClassName)
;
class_<PolySecondBase>("PolySecondBase")
- .smart_ptr<std::shared_ptr<PolySecondBase>>()
+ .smart_ptr<std::shared_ptr<PolySecondBase>>("shared_ptr<PolySecondBase>")
.constructor<>()
.function("getClassName", &PolySecondBase::getClassName)
;
class_<PolyDerived, base<PolyBase>>("PolyDerived")
- .smart_ptr<std::shared_ptr<PolyDerived>>()
+ .smart_ptr<std::shared_ptr<PolyDerived>>("shared_ptr<PolyDerived>")
.constructor<>()
.function("virtualGetClassName", &PolyDerived::virtualGetClassName)
.function("getClassName", &PolyDerived::getClassName)
@@ -1671,43 +1671,43 @@ EMSCRIPTEN_BINDINGS(tests) {
// }
class_<PolySiblingDerived, base<PolyBase>>("PolySiblingDerived")
- .smart_ptr<std::shared_ptr<PolySiblingDerived>>()
+ .smart_ptr<std::shared_ptr<PolySiblingDerived>>("shared_ptr<PolySiblingDerived>")
.constructor<>()
.function("getClassName", &PolySiblingDerived::getClassName)
;
class_<PolyMultiplyDerived, base<PolyBase>>("PolyMultiplyDerived")
- .smart_ptr<std::shared_ptr<PolyMultiplyDerived>>()
+ .smart_ptr<std::shared_ptr<PolyMultiplyDerived>>("shared_ptr<PolyMultiplyDerived>")
.constructor<>()
.function("getClassName", &PolyMultiplyDerived::getClassName)
;
class_<PolyDerivedThrice, base<PolyDerived>>("PolyDerivedThrice")
- .smart_ptr<std::shared_ptr<PolyDerivedThrice>>()
+ .smart_ptr<std::shared_ptr<PolyDerivedThrice>>("shared_ptr<PolyDerivedThrice>")
.constructor<>()
.function("getClassName", &PolyDerivedThrice::getClassName)
;
class_<PolyDiamondBase>("PolyDiamondBase")
- .smart_ptr<std::shared_ptr<PolyDiamondBase>>()
+ .smart_ptr<std::shared_ptr<PolyDiamondBase>>("shared_ptr<PolyDiamondBase>")
.constructor<>()
.function("getClassName", &PolyDiamondBase::getClassName)
;
class_<PolyDiamondDerived>("PolyDiamondDerived")
- .smart_ptr<std::shared_ptr<PolyDiamondDerived>>()
+ .smart_ptr<std::shared_ptr<PolyDiamondDerived>>("shared_ptr<PolyDiamondDerived>")
.constructor<>()
.function("getClassName", &PolyDiamondDerived::getClassName)
;
class_<PolyDiamondSiblingDerived>("PolyDiamondSiblingDerived")
- .smart_ptr<std::shared_ptr<PolyDiamondSiblingDerived>>()
+ .smart_ptr<std::shared_ptr<PolyDiamondSiblingDerived>>("shared_ptr<PolyDiamondSiblingDerived>")
.constructor<>()
.function("getClassName", &PolyDiamondSiblingDerived::getClassName)
;
class_<PolyDiamondMultiplyDerived>("PolyDiamondMultiplyDerived")
- .smart_ptr<std::shared_ptr<PolyDiamondMultiplyDerived>>()
+ .smart_ptr<std::shared_ptr<PolyDiamondMultiplyDerived>>("shared_ptr<PolyDiamondMultiplyDerived>")
.constructor<>()
.function("getClassName", &PolyDiamondMultiplyDerived::getClassName)
;
@@ -1825,8 +1825,8 @@ EMSCRIPTEN_BINDINGS(tests) {
auto HeldBySmartPtr_class = class_<HeldBySmartPtr>("HeldBySmartPtr");
HeldBySmartPtr_class
- .smart_ptr<CustomSmartPtr<HeldBySmartPtr>>()
- .smart_ptr_constructor(&std::make_shared<HeldBySmartPtr, int, std::string>)
+ .smart_ptr<CustomSmartPtr<HeldBySmartPtr>>("CustomSmartPtr<HeldBySmartPtr>")
+ .smart_ptr_constructor("shared_ptr<HeldbySmartPtr>", &std::make_shared<HeldBySmartPtr, int, std::string>)
.class_function("newCustomPtr", HeldBySmartPtr::newCustomPtr)
.function("returnThis", &takesHeldBySmartPtrSharedPtr)
.property("i", &HeldBySmartPtr::i)
@@ -1836,8 +1836,8 @@ EMSCRIPTEN_BINDINGS(tests) {
function("takesHeldBySmartPtrSharedPtr", &takesHeldBySmartPtrSharedPtr);
class_<HeldByCustomSmartPtr>("HeldByCustomSmartPtr")
- .smart_ptr<std::shared_ptr<HeldByCustomSmartPtr>>()
- .smart_ptr_constructor(&HeldByCustomSmartPtr::create)
+ .smart_ptr<std::shared_ptr<HeldByCustomSmartPtr>>("shared_ptr<HeldByCustomSmartPtr>")
+ .smart_ptr_constructor("CustomSmartPtr<HeldByCustomSmartPtr>", &HeldByCustomSmartPtr::create)
.class_function("createSharedPtr", &HeldByCustomSmartPtr::createSharedPtr)
.property("i", &HeldByCustomSmartPtr::i)
.property("s", &HeldByCustomSmartPtr::s)
@@ -2022,7 +2022,7 @@ EMSCRIPTEN_BINDINGS(overloads) {
;
class_<MultipleSmartCtors>("MultipleSmartCtors")
- .smart_ptr<std::shared_ptr<MultipleSmartCtors>>()
+ .smart_ptr<std::shared_ptr<MultipleSmartCtors>>("shared_ptr<MultipleSmartCtors>")
.constructor(&std::make_shared<MultipleSmartCtors, int>)
.constructor(&std::make_shared<MultipleSmartCtors, int, int>)
.function("WhichCtorCalled", &MultipleSmartCtors::WhichCtorCalled)
@@ -2147,6 +2147,8 @@ struct BoundClass {
};
EMSCRIPTEN_BINDINGS(incomplete) {
+ constant("hasUnboundTypeNames", emscripten::has_unbound_type_names);
+
function("getUnboundClass", &passThrough<UnboundClass>);
class_<HasUnboundBase, base<UnboundClass>>("HasUnboundBase")
@@ -2247,7 +2249,7 @@ std::shared_ptr<Base> return_Base_from_DerivedWithOffset(std::shared_ptr<Derived
EMSCRIPTEN_BINDINGS(with_adjustment) {
class_<DerivedWithOffset, base<Base>>("DerivedWithOffset")
- .smart_ptr_constructor(&std::make_shared<DerivedWithOffset>)
+ .smart_ptr_constructor("shared_ptr<DerivedWithOffset>", &std::make_shared<DerivedWithOffset>)
;
function("return_Base_from_DerivedWithOffset", &return_Base_from_DerivedWithOffset);
diff --git a/tests/fuzz/19.c b/tests/fuzz/19.c
new file mode 100644
index 00000000..d94318c5
--- /dev/null
+++ b/tests/fuzz/19.c
@@ -0,0 +1,1408 @@
+/*
+ * This is a RANDOMLY GENERATED PROGRAM.
+ *
+ * Generator: csmith 2.2.0
+ * Git version: bf42ffd
+ * Options: --no-volatiles --no-packed-struct --no-math64
+ * Seed: 2524651702
+ */
+
+#include "csmith.h"
+
+
+static long __undefined;
+
+/* --- Struct/Union Declarations --- */
+/* --- GLOBAL VARIABLES --- */
+static uint32_t g_2[5][1] = {{0xF1124F01L},{0x1F2C29A3L},{0xF1124F01L},{0x1F2C29A3L},{0xF1124F01L}};
+static int32_t g_3 = 0x3FA75C19L;
+static uint32_t g_14[6] = {0xD1A4E665L,0xD1A4E665L,0xD1A4E665L,0xD1A4E665L,0xD1A4E665L,0xD1A4E665L};
+static uint32_t g_15 = 18446744073709551615UL;
+static int32_t g_34 = 1L;
+static int8_t g_36 = 0x6DL;
+static uint8_t g_40[7] = {0xEAL,0xEAL,0xEAL,0xEAL,0xEAL,0xEAL,0xEAL};
+static uint8_t g_44 = 0UL;
+static uint8_t *g_43 = &g_44;
+static int32_t g_46 = 0x461302D9L;
+static int32_t g_51[2][8][3] = {{{0x0D357E8FL,0x604C38DBL,0x0D357E8FL},{0x0D357E8FL,0x349DDA4AL,0x1ADF561FL},{0x0D357E8FL,0x2D584125L,(-4L)},{0x0D357E8FL,0x604C38DBL,0x0D357E8FL},{0x0D357E8FL,0x349DDA4AL,0x1ADF561FL},{0x0D357E8FL,0x2D584125L,(-4L)},{0x0D357E8FL,0x604C38DBL,0x0D357E8FL},{0x0D357E8FL,0x349DDA4AL,0x1ADF561FL}},{{0x0D357E8FL,0x2D584125L,(-4L)},{0x0D357E8FL,0x1ADF561FL,(-10L)},{(-10L),0x0D357E8FL,0xCF8610F1L},{(-10L),(-4L),(-9L)},{(-10L),0x1ADF561FL,(-10L)},{(-10L),0x0D357E8FL,0xCF8610F1L},{(-10L),(-4L),(-9L)},{(-10L),0x1ADF561FL,(-10L)}}};
+static uint32_t g_52 = 0x171C63CCL;
+static uint32_t g_56 = 0xFBFBE831L;
+static uint32_t *g_55 = &g_56;
+static const int8_t * const g_132 = &g_36;
+static const int8_t * const *g_131 = &g_132;
+static int32_t g_140 = 0L;
+static int32_t *g_143 = &g_140;
+static uint8_t **g_175 = &g_43;
+static uint8_t **g_176 = &g_43;
+static uint8_t **g_177 = (void*)0;
+static int8_t *g_243[6][2][9] = {{{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36},{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36}},{{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36},{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36}},{{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36},{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36}},{{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36},{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36}},{{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36},{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36}},{{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36},{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36}}};
+static int8_t **g_242 = &g_243[5][1][5];
+static int8_t **g_245 = &g_243[5][1][5];
+static uint16_t g_251 = 0x6187L;
+static int8_t g_255 = 0xFEL;
+static int16_t g_290 = 0xF4DEL;
+static int16_t *g_289 = &g_290;
+static uint32_t g_294[5] = {0xFDB146E2L,0xFDB146E2L,0xFDB146E2L,0xFDB146E2L,0xFDB146E2L};
+static int32_t g_297[2] = {1L,1L};
+static int32_t *g_312[2][1][6] = {{{(void*)0,(void*)0,&g_51[0][3][1],(void*)0,(void*)0,&g_51[0][3][1]}},{{(void*)0,(void*)0,&g_51[0][3][1],(void*)0,(void*)0,&g_51[0][3][1]}}};
+static uint8_t g_320 = 0xD4L;
+static int16_t g_347 = 0x586CL;
+static int16_t g_419 = 0xDAAFL;
+static uint32_t g_477 = 0x661A1A9FL;
+static uint32_t g_705[6] = {1UL,1UL,1UL,1UL,1UL,1UL};
+static uint32_t ** const g_736 = &g_55;
+static uint32_t ** const *g_735 = &g_736;
+static uint8_t ****g_897 = (void*)0;
+static uint8_t ***g_905 = &g_175;
+static uint8_t ****g_904[3][6] = {{&g_905,&g_905,&g_905,&g_905,&g_905,&g_905},{&g_905,&g_905,&g_905,&g_905,&g_905,&g_905},{&g_905,&g_905,&g_905,&g_905,&g_905,&g_905}};
+static int32_t **g_961 = &g_312[1][0][4];
+static int32_t ***g_960 = &g_961;
+static uint16_t g_969 = 5UL;
+static int8_t ***g_1019[7][1][1] = {{{&g_242}},{{&g_242}},{{&g_242}},{{&g_242}},{{&g_242}},{{&g_242}},{{&g_242}}};
+static int8_t ****g_1018 = &g_1019[3][0][0];
+static int32_t g_1055 = (-8L);
+static uint32_t g_1099 = 0xAD3B6902L;
+static int32_t g_1132 = (-9L);
+static int16_t * const *g_1185 = &g_289;
+static int16_t * const * const *g_1184 = &g_1185;
+static int16_t g_1189 = 0L;
+static uint32_t **g_1238 = &g_55;
+static uint32_t ***g_1237[8][4][4] = {{{&g_1238,(void*)0,&g_1238,(void*)0},{&g_1238,(void*)0,&g_1238,&g_1238},{(void*)0,&g_1238,&g_1238,(void*)0},{(void*)0,&g_1238,(void*)0,&g_1238}},{{&g_1238,(void*)0,(void*)0,&g_1238},{&g_1238,&g_1238,&g_1238,(void*)0},{&g_1238,&g_1238,&g_1238,(void*)0},{&g_1238,(void*)0,&g_1238,&g_1238}},{{&g_1238,&g_1238,&g_1238,(void*)0},{&g_1238,&g_1238,&g_1238,&g_1238},{&g_1238,(void*)0,(void*)0,&g_1238},{(void*)0,&g_1238,(void*)0,(void*)0}},{{&g_1238,(void*)0,&g_1238,(void*)0},{&g_1238,&g_1238,(void*)0,(void*)0},{(void*)0,(void*)0,&g_1238,&g_1238},{&g_1238,&g_1238,&g_1238,&g_1238}},{{&g_1238,&g_1238,&g_1238,&g_1238},{&g_1238,&g_1238,&g_1238,&g_1238},{&g_1238,&g_1238,&g_1238,&g_1238},{&g_1238,(void*)0,(void*)0,(void*)0}},{{&g_1238,&g_1238,&g_1238,(void*)0},{&g_1238,(void*)0,&g_1238,(void*)0},{(void*)0,&g_1238,(void*)0,&g_1238},{&g_1238,(void*)0,(void*)0,&g_1238}},{{&g_1238,&g_1238,&g_1238,(void*)0},{&g_1238,&g_1238,&g_1238,&g_1238},{&g_1238,(void*)0,&g_1238,(void*)0},{&g_1238,&g_1238,&g_1238,(void*)0}},{{&g_1238,&g_1238,&g_1238,&g_1238},{(void*)0,(void*)0,&g_1238,&g_1238},{(void*)0,&g_1238,&g_1238,(void*)0},{&g_1238,&g_1238,&g_1238,&g_1238}}};
+static uint32_t ***g_1241 = (void*)0;
+static uint32_t g_1254[8][1][8] = {{{0x441F7909L,0x441F7909L,0UL,0x5B976413L,18446744073709551610UL,0UL,18446744073709551610UL,0x5B976413L}},{{0x0ECD52E7L,0x5B976413L,0x0ECD52E7L,0xD72EFABCL,0x5B976413L,0x6701CBD7L,0x6701CBD7L,0x5B976413L}},{{0x5B976413L,0x6701CBD7L,0x6701CBD7L,0x5B976413L,0xD72EFABCL,0x0ECD52E7L,0x5B976413L,0x0ECD52E7L}},{{0x5B976413L,18446744073709551610UL,0UL,18446744073709551610UL,0x5B976413L,0UL,0x441F7909L,0x441F7909L}},{{0x0ECD52E7L,18446744073709551610UL,0xD72EFABCL,0xD72EFABCL,18446744073709551610UL,0x0ECD52E7L,0x6701CBD7L,18446744073709551610UL}},{{0x441F7909L,0x6701CBD7L,0xD72EFABCL,0x441F7909L,0xD72EFABCL,0x6701CBD7L,0x441F7909L,0x0ECD52E7L}},{{18446744073709551610UL,0x5B976413L,0UL,0x441F7909L,0x441F7909L,0UL,0x5B976413L,18446744073709551610UL}},{{0x0ECD52E7L,0x441F7909L,0x6701CBD7L,0xD72EFABCL,0x441F7909L,0xD72EFABCL,0x6701CBD7L,0x441F7909L}}};
+static int16_t g_1285 = 0L;
+static uint8_t * const **g_1295 = (void*)0;
+static uint8_t g_1298 = 0xB8L;
+static int16_t g_1333 = 0x34D4L;
+static uint32_t g_1334 = 0x1191E655L;
+static int32_t g_1509 = 1L;
+static uint8_t ***g_1548 = &g_176;
+static uint8_t ***g_1549 = (void*)0;
+static uint8_t ***g_1550 = (void*)0;
+static uint8_t ***g_1551[3][5] = {{&g_176,&g_176,&g_176,&g_176,&g_176},{&g_176,&g_176,&g_176,&g_176,&g_176},{&g_176,&g_176,&g_176,&g_176,&g_176}};
+static uint8_t ***g_1552[10][9] = {{&g_175,&g_177,&g_175,(void*)0,&g_175,&g_175,(void*)0,&g_175,&g_177},{(void*)0,&g_175,&g_175,(void*)0,&g_175,&g_177,&g_176,&g_175,&g_175},{&g_175,&g_175,&g_177,(void*)0,&g_177,&g_175,&g_175,&g_177,&g_175},{&g_176,&g_175,&g_176,(void*)0,&g_177,&g_176,&g_176,&g_176,&g_177},{&g_176,&g_177,&g_177,&g_176,&g_175,&g_176,(void*)0,&g_177,&g_176},{&g_175,&g_177,&g_175,(void*)0,&g_175,&g_175,(void*)0,&g_175,&g_177},{(void*)0,&g_175,&g_175,(void*)0,&g_175,&g_177,&g_176,&g_175,&g_175},{&g_175,&g_175,&g_177,(void*)0,&g_177,&g_175,&g_175,&g_177,&g_175},{&g_176,&g_175,&g_176,(void*)0,&g_177,&g_176,&g_176,&g_176,&g_177},{&g_176,&g_177,&g_177,&g_176,&g_175,&g_176,(void*)0,&g_177,&g_176}};
+static uint8_t **** const g_1547[1][6][2] = {{{&g_1551[1][3],&g_1552[7][4]},{&g_1551[1][3],&g_1551[1][3]},{&g_1552[7][4],&g_1551[1][3]},{&g_1551[1][3],&g_1552[7][4]},{&g_1551[1][3],&g_1551[1][3]},{&g_1552[7][4],&g_1551[1][3]}}};
+static uint8_t **** const *g_1546[5] = {&g_1547[0][2][0],&g_1547[0][2][0],&g_1547[0][2][0],&g_1547[0][2][0],&g_1547[0][2][0]};
+static int8_t ***g_1656 = &g_245;
+static uint16_t g_1766 = 0x2A71L;
+static const uint32_t g_1776 = 4294967288UL;
+static const uint32_t g_1782[6][8][5] = {{{9UL,1UL,0xC7DDDB76L,0x6C0C4151L,0x8031E06CL},{4294967288UL,0x67522ABBL,4294967289UL,9UL,0x6B1862C6L},{4294967289UL,0x035D4646L,0x4BD87A52L,0xF04D3E88L,0x02BA768FL},{0x67522ABBL,1UL,0xFBE5C2AFL,0x09838561L,0x6E51EAD8L},{0x67522ABBL,0x8031E06CL,0xFC56E314L,0x5133D18EL,0xF04D3E88L},{4294967289UL,0xFBE5C2AFL,4294967286UL,4294967295UL,4294967295UL},{4294967288UL,4294967289UL,4294967288UL,0xFC56E314L,0x4BD87A52L},{9UL,0x09838561L,4294967295UL,1UL,3UL}},{{0xD3C5907BL,0x6C0C4151L,4294967289UL,0x8031E06CL,0x035D4646L},{0x6B1862C6L,0x6E51EAD8L,4294967295UL,3UL,0x02BA768FL},{4294967294UL,0xD3C5907BL,4294967288UL,0x67522ABBL,4294967289UL},{0x6C0C4151L,0x8031E06CL,4294967286UL,4294967295UL,0xB9EFEB98L},{8UL,4294967291UL,0xFC56E314L,4294967295UL,0x2B8C1A21L},{4294967291UL,0x6B1862C6L,0xFBE5C2AFL,1UL,0x2B8C1A21L},{9UL,0x1C34F8ADL,0x4BD87A52L,4294967288UL,0xB9EFEB98L},{1UL,4294967288UL,4294967289UL,0xB9EFEB98L,4294967289UL}},{{0xE9241C7AL,0xE9241C7AL,0x6E51EAD8L,1UL,0x09838561L},{4294967288UL,3UL,0x8031E06CL,4294967291UL,0x37358859L},{1UL,4294967295UL,0xD83C2DFAL,1UL,4294967286UL},{0x4478B581L,3UL,0x2B8C1A21L,8UL,0x5A8F52F4L},{0xB9EFEB98L,0xE9241C7AL,0xF04D3E88L,0xC7DDDB76L,8UL},{1UL,1UL,0UL,7UL,0x5133D18EL},{0xF04D3E88L,4294967291UL,0x084A6D3FL,4294967286UL,0x02BA768FL},{0x02BA768FL,0xB3D218BBL,4294967289UL,4294967286UL,0x09838561L}},{{0x2BAF5CEFL,9UL,0xFDF9E1B7L,7UL,0xB3D218BBL},{4294967291UL,4294967295UL,0xC7DDDB76L,0xC7DDDB76L,4294967295UL},{0x37358859L,0x9D243B0BL,4294967295UL,8UL,4294967289UL},{0xFDF9E1B7L,0x02BA768FL,0x9D243B0BL,1UL,0x6B1862C6L},{1UL,0xFBE5C2AFL,0x6B1862C6L,4294967291UL,4294967286UL},{0xFDF9E1B7L,0x2BAF5CEFL,0x084A6D3FL,1UL,0x731D77D9L},{0x37358859L,0x084A6D3FL,0x035D4646L,0xFC56E314L,0x09838561L},{4294967291UL,0xB9EFEB98L,9UL,1UL,0x4478B581L}},{{0x2BAF5CEFL,4294967295UL,4294967291UL,4294967295UL,1UL},{0x02BA768FL,0x8031E06CL,4294967291UL,8UL,0UL},{0xF04D3E88L,0x37358859L,9UL,0x2B8C1A21L,0x6E51EAD8L},{1UL,0xD3C5907BL,0x035D4646L,0xD3C5907BL,1UL},{0xB9EFEB98L,4294967288UL,0x084A6D3FL,4294967286UL,0xE9241C7AL},{0x4478B581L,0x731D77D9L,0x6B1862C6L,4294967295UL,0x09838561L},{1UL,0xFDF9E1B7L,0x9D243B0BL,4294967288UL,0xE9241C7AL},{4294967288UL,4294967295UL,4294967295UL,0x4BD87A52L,1UL}},{{0xE9241C7AL,0xF04D3E88L,0xC7DDDB76L,8UL,0x6E51EAD8L},{0x8031E06CL,0x4478B581L,0xFDF9E1B7L,4294967291UL,0UL},{1UL,7UL,4294967289UL,0x2BAF5CEFL,1UL},{9UL,7UL,0x084A6D3FL,0x5133D18EL,0x4478B581L},{0x731D77D9L,0x4478B581L,0UL,1UL,0x09838561L},{0xFBE5C2AFL,0xF04D3E88L,0xF04D3E88L,0xFBE5C2AFL,0x731D77D9L},{7UL,4294967295UL,0x2B8C1A21L,0xD83C2DFAL,4294967286UL},{0xB3D218BBL,0xFDF9E1B7L,0xD83C2DFAL,8UL,0x6B1862C6L}}};
+static const uint32_t *g_1781 = &g_1782[2][3][4];
+static int8_t g_1857 = 0L;
+static const uint8_t *g_1941 = (void*)0;
+static const uint8_t ** const g_1940[7] = {&g_1941,&g_1941,&g_1941,&g_1941,&g_1941,&g_1941,&g_1941};
+static const uint8_t ** const *g_1939 = &g_1940[2];
+static const uint8_t ** const **g_1938 = &g_1939;
+static const uint8_t ** const ***g_1937 = &g_1938;
+static int16_t g_1961 = (-2L);
+static const int8_t g_2067 = (-1L);
+static const uint32_t ***g_2068[3] = {(void*)0,(void*)0,(void*)0};
+static int8_t g_2147[10] = {0x23L,0x23L,0x23L,0x23L,0x23L,0x23L,0x23L,0x23L,0x23L,0x23L};
+static uint16_t g_2148 = 0x794EL;
+static int16_t g_2207 = 0L;
+
+
+/* --- FORWARD DECLARATIONS --- */
+static uint16_t func_1(void);
+static int8_t func_10(uint32_t p_11);
+static int32_t func_16(int8_t p_17, uint32_t * p_18, uint32_t * p_19, uint16_t p_20, uint32_t p_21);
+static uint32_t * func_22(int16_t p_23, uint32_t p_24, uint32_t * p_25);
+static int32_t func_62(int32_t * p_63, uint8_t p_64);
+static int32_t * func_65(int8_t p_66, uint16_t p_67, uint8_t p_68, int32_t * p_69, uint32_t * p_70);
+static uint8_t * func_71(uint32_t p_72, int8_t p_73);
+static int32_t *