diff options
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 29 | ||||
-rw-r--r-- | test/example/c-api-relooper-unreachable-if.cpp | 20 | ||||
-rw-r--r-- | test/example/c-api-unused-mem.cpp | 20 | ||||
-rw-r--r-- | test/example/relooper-fuzz.c | 3 | ||||
-rw-r--r-- | test/example/relooper-fuzz1.c | 3 | ||||
-rw-r--r-- | test/example/relooper-fuzz2.c | 3 | ||||
-rw-r--r-- | test/example/relooper-merge1.c | 3 | ||||
-rw-r--r-- | test/example/relooper-merge2.c | 3 | ||||
-rw-r--r-- | test/example/relooper-merge3.c | 3 | ||||
-rw-r--r-- | test/example/relooper-merge4.c | 3 | ||||
-rw-r--r-- | test/example/relooper-merge5.c | 3 | ||||
-rw-r--r-- | test/example/relooper-merge6.c | 3 |
12 files changed, 59 insertions, 37 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index edf8d61f7..d5681097c 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -530,8 +530,9 @@ void test_core() { // Memory. Add it before creating any memory-using instructions. - const char* segments[] = {"hello, world", "I am passive"}; - bool segmentPassive[] = {false, true}; + const char* segmentNames[] = {"0", "1"}; + const char* segmentDatas[] = {"hello, world", "I am passive"}; + bool segmentPassives[] = {false, true}; BinaryenExpressionRef segmentOffsets[] = { BinaryenConst(module, BinaryenLiteralInt32(10)), NULL}; BinaryenIndex segmentSizes[] = {12, 12}; @@ -539,8 +540,9 @@ void test_core() { 1, 256, "mem", - segments, - segmentPassive, + segmentNames, + segmentDatas, + segmentPassives, segmentOffsets, segmentSizes, 2, @@ -2085,9 +2087,10 @@ void test_for_each() { assert(BinaryenGetExportByIndex(module, i) == exps[i]); } - const char* segments[] = {"hello, world", "segment data 2"}; + const char* segmentNames[] = {"0", "1"}; + const char* segmentDatas[] = {"hello, world", "segment data 2"}; const uint32_t expected_offsets[] = {10, 125}; - bool segmentPassive[] = {false, false}; + bool segmentPassives[] = {false, false}; BinaryenIndex segmentSizes[] = {12, 14}; BinaryenExpressionRef segmentOffsets[] = { @@ -2097,8 +2100,9 @@ void test_for_each() { 1, 256, "mem", - segments, - segmentPassive, + segmentNames, + segmentDatas, + segmentPassives, segmentOffsets, segmentSizes, 2, @@ -2113,11 +2117,12 @@ void test_for_each() { for (i = 0; i < BinaryenGetNumMemorySegments(module); i++) { char out[15] = {}; - assert(BinaryenGetMemorySegmentByteOffset(module, i) == + assert(BinaryenGetMemorySegmentByteOffset(module, segmentNames[i]) == expected_offsets[i]); - assert(BinaryenGetMemorySegmentByteLength(module, i) == segmentSizes[i]); - BinaryenCopyMemorySegmentData(module, i, out); - assert(0 == strcmp(segments[i], out)); + assert(BinaryenGetMemorySegmentByteLength(module, segmentNames[i]) == + segmentSizes[i]); + BinaryenCopyMemorySegmentData(module, segmentNames[i], out); + assert(0 == strcmp(segmentDatas[i], out)); } } { diff --git a/test/example/c-api-relooper-unreachable-if.cpp b/test/example/c-api-relooper-unreachable-if.cpp index 1c5708835..96c6c1149 100644 --- a/test/example/c-api-relooper-unreachable-if.cpp +++ b/test/example/c-api-relooper-unreachable-if.cpp @@ -15,16 +15,18 @@ int main() { expressions[size_t(NULL)] = BinaryenExpressionRef(NULL); BinaryenModuleAutoDrop(the_module); { - const char* segments[] = {0}; - bool segmentPassive[] = {false}; + const char* segmentNames[] = {"0"}; + const char* segmentDatas[] = {0}; + bool segmentPassives[] = {false}; BinaryenExpressionRef segmentOffsets[] = {0}; BinaryenIndex segmentSizes[] = {0}; BinaryenSetMemory(the_module, 256, 256, "memory", - segments, - segmentPassive, + segmentNames, + segmentDatas, + segmentPassives, segmentOffsets, segmentSizes, 0, @@ -585,16 +587,18 @@ int main() { } BinaryenAddFunctionExport(the_module, "main", "main"); { - const char* segments[] = {0}; + const char* segmentNames[] = {"0"}; + const char* segmentDatas[] = {0}; BinaryenExpressionRef segmentOffsets[] = {0}; - bool segmentPassive[] = {false}; + bool segmentPassives[] = {false}; BinaryenIndex segmentSizes[] = {0}; BinaryenSetMemory(the_module, 1, 1, NULL, - segments, - segmentPassive, + segmentNames, + segmentDatas, + segmentPassives, segmentOffsets, segmentSizes, 0, diff --git a/test/example/c-api-unused-mem.cpp b/test/example/c-api-unused-mem.cpp index a0970a8ca..750f3b703 100644 --- a/test/example/c-api-unused-mem.cpp +++ b/test/example/c-api-unused-mem.cpp @@ -16,16 +16,18 @@ int main() { expressions[size_t(NULL)] = BinaryenExpressionRef(NULL); BinaryenModuleAutoDrop(the_module); { - const char* segments[] = {0}; - bool segmentPassive[] = {false}; + const char* segmentNames[] = {"0"}; + const char* segmentDatas[] = {0}; + bool segmentPassives[] = {false}; BinaryenExpressionRef segmentOffsets[] = {0}; BinaryenIndex segmentSizes[] = {0}; BinaryenSetMemory(the_module, 256, 256, "memory", - segments, - segmentPassive, + segmentNames, + segmentDatas, + segmentPassives, segmentOffsets, segmentSizes, 0, @@ -81,16 +83,18 @@ int main() { } BinaryenAddFunctionExport(the_module, "main", "main"); { - const char* segments[] = {0}; - bool segmentPassive[] = {false}; + const char* segmentNames[] = {"0"}; + const char* segmentDatas[] = {0}; + bool segmentPassives[] = {false}; BinaryenExpressionRef segmentOffsets[] = {0}; BinaryenIndex segmentSizes[] = {0}; BinaryenSetMemory(the_module, 1024, 1024, NULL, - segments, - segmentPassive, + segmentNames, + segmentDatas, + segmentPassives, segmentOffsets, segmentSizes, 0, diff --git a/test/example/relooper-fuzz.c b/test/example/relooper-fuzz.c index a648e61b4..afa8e7ec1 100644 --- a/test/example/relooper-fuzz.c +++ b/test/example/relooper-fuzz.c @@ -369,7 +369,8 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, 0, "0"); + BinaryenSetMemory( + module, 1, 1, "mem", NULL, NULL, NULL, NULL, NULL, 0, 0, 0, "0"); assert(BinaryenModuleValidate(module)); diff --git a/test/example/relooper-fuzz1.c b/test/example/relooper-fuzz1.c index a524922d7..a2594407a 100644 --- a/test/example/relooper-fuzz1.c +++ b/test/example/relooper-fuzz1.c @@ -366,7 +366,8 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, 0, "0"); + BinaryenSetMemory( + module, 1, 1, "mem", NULL, NULL, NULL, NULL, NULL, 0, 0, 0, "0"); assert(BinaryenModuleValidate(module)); diff --git a/test/example/relooper-fuzz2.c b/test/example/relooper-fuzz2.c index 8d129b77b..9ccba34d7 100644 --- a/test/example/relooper-fuzz2.c +++ b/test/example/relooper-fuzz2.c @@ -690,7 +690,8 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, 0, "0"); + BinaryenSetMemory( + module, 1, 1, "mem", NULL, NULL, NULL, NULL, NULL, 0, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge1.c b/test/example/relooper-merge1.c index 4086de438..d571696f8 100644 --- a/test/example/relooper-merge1.c +++ b/test/example/relooper-merge1.c @@ -232,7 +232,8 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, 0, "0"); + BinaryenSetMemory( + module, 1, 1, "mem", NULL, NULL, NULL, NULL, NULL, 0, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge2.c b/test/example/relooper-merge2.c index d85f9d71c..c70ef5601 100644 --- a/test/example/relooper-merge2.c +++ b/test/example/relooper-merge2.c @@ -247,7 +247,8 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, 0, "0"); + BinaryenSetMemory( + module, 1, 1, "mem", NULL, NULL, NULL, NULL, NULL, 0, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge3.c b/test/example/relooper-merge3.c index 9347e0fde..933739254 100644 --- a/test/example/relooper-merge3.c +++ b/test/example/relooper-merge3.c @@ -231,7 +231,8 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, 0, "0"); + BinaryenSetMemory( + module, 1, 1, "mem", NULL, NULL, NULL, NULL, NULL, 0, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge4.c b/test/example/relooper-merge4.c index b4373454d..6fc36be36 100644 --- a/test/example/relooper-merge4.c +++ b/test/example/relooper-merge4.c @@ -231,7 +231,8 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, 0, "0"); + BinaryenSetMemory( + module, 1, 1, "mem", NULL, NULL, NULL, NULL, NULL, 0, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge5.c b/test/example/relooper-merge5.c index 79ee6abc8..7e4fbee0f 100644 --- a/test/example/relooper-merge5.c +++ b/test/example/relooper-merge5.c @@ -231,7 +231,8 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, 0, "0"); + BinaryenSetMemory( + module, 1, 1, "mem", NULL, NULL, NULL, NULL, NULL, 0, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge6.c b/test/example/relooper-merge6.c index 774dd934c..93043ef32 100644 --- a/test/example/relooper-merge6.c +++ b/test/example/relooper-merge6.c @@ -234,7 +234,8 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, 0, "0"); + BinaryenSetMemory( + module, 1, 1, "mem", NULL, NULL, NULL, NULL, NULL, 0, 0, 0, "0"); // optionally, optimize if (0) |