diff options
author | Daniel Wirtz <dcode@dcode.io> | 2021-02-26 11:48:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-26 11:48:09 +0100 |
commit | b3f67918fe34e7de76d1f5565bd3f07f4f7eb12f (patch) | |
tree | 7a029f016fd0057735db5a3643cda35dc6b9eddd /test/example | |
parent | 54d13b1cab26e8b48d95b573e46ab672c0564d0f (diff) | |
download | binaryen-b3f67918fe34e7de76d1f5565bd3f07f4f7eb12f.tar.gz binaryen-b3f67918fe34e7de76d1f5565bd3f07f4f7eb12f.tar.bz2 binaryen-b3f67918fe34e7de76d1f5565bd3f07f4f7eb12f.zip |
Slightly improve table C API (#3604)
Uses BinaryenIndex instead of int to mirror parameter types in table construction, and adds setters for name, initial and max.
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-multiple-tables.c | 6 | ||||
-rw-r--r-- | test/example/c-api-multiple-tables.txt | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/test/example/c-api-multiple-tables.c b/test/example/c-api-multiple-tables.c index 9d0c9ebfd..625af444c 100644 --- a/test/example/c-api-multiple-tables.c +++ b/test/example/c-api-multiple-tables.c @@ -51,9 +51,15 @@ int main() { assert(t2 != NULL); assert(strcmp(BinaryenTableGetName(t2), "t2") == 0); + BinaryenTableSetName(t2, "table2"); + assert(strcmp(BinaryenTableGetName(t2), "table2") == 0); assert(BinaryenTableGetInitial(t2) == 1); + BinaryenTableSetInitial(t2, 2); + assert(BinaryenTableGetInitial(t2) == 2); assert(BinaryenTableHasMax(t2) == 1); assert(BinaryenTableGetMax(t2) == 1); + BinaryenTableSetMax(t2, 2); + assert(BinaryenTableGetMax(t2) == 2); assert(strcmp(BinaryenTableImportGetModule(t2), "") == 0); assert(strcmp(BinaryenTableImportGetBase(t2), "") == 0); diff --git a/test/example/c-api-multiple-tables.txt b/test/example/c-api-multiple-tables.txt index c0f2da53b..5b2858e91 100644 --- a/test/example/c-api-multiple-tables.txt +++ b/test/example/c-api-multiple-tables.txt @@ -2,8 +2,8 @@ (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (table $tab 1 1 funcref) (elem (table $tab) (i32.const 0) func $adder) - (table $t2 1 1 funcref) - (elem (table $t2) (i32.const 0) func $adder) + (table $table2 2 2 funcref) + (elem (table $table2) (i32.const 0) func $adder) (func $adder (param $0 i32) (param $1 i32) (result i32) (i32.add (local.get $0) |