diff --git a/tests/runtime/flavorful/wasm.go b/tests/runtime/flavorful/wasm.go index 721d0a3a4..78f289809 100644 --- a/tests/runtime/flavorful/wasm.go +++ b/tests/runtime/flavorful/wasm.go @@ -7,52 +7,52 @@ import ( func init() { n := &FlavorfulImpl{} SetFlavorful(n) - SetExports(n) + SetExportsTestFlavorfulTest(n) } type FlavorfulImpl struct{} func (f FlavorfulImpl) TestImports() { - ImportsFListInRecord1(ImportsListInRecord1{"list_in_record1"}) - if ImportsFListInRecord2().A != "list_in_record2" { - panic("ImportsFListInRecord2") + TestFlavorfulTestFListInRecord1(TestFlavorfulTestListInRecord1{"list_in_record1"}) + if TestFlavorfulTestFListInRecord2().A != "list_in_record2" { + panic("TestFlavorfulTestFListInRecord2") } - if ImportsFListInRecord3(ImportsListInRecord3{"list_in_record3 input"}).A != "list_in_record3 output" { - panic("ImportsFListInRecord3") + if TestFlavorfulTestFListInRecord3(TestFlavorfulTestListInRecord3{"list_in_record3 input"}).A != "list_in_record3 output" { + panic("TestFlavorfulTestFListInRecord3") } - if ImportsFListInRecord4(ImportsListInAlias{"input4"}).A != "result4" { - panic("ImportsFListInRecord4") + if TestFlavorfulTestFListInRecord4(TestFlavorfulTestListInAlias{"input4"}).A != "result4" { + panic("TestFlavorfulTestFListInRecord4") } var b Result[struct{}, string] b.SetErr("bar") - ImportsFListInVariant1(Some[string]("foo"), b, ImportsListInVariant1V3F0("baz")) - if ImportsFListInVariant2().Unwrap() != "list_in_variant2" { - panic("ImportsFListInVariant2") + TestFlavorfulTestFListInVariant1(Some[string]("foo"), b, TestFlavorfulTestListInVariant1V3F0("baz")) + if TestFlavorfulTestFListInVariant2().Unwrap() != "list_in_variant2" { + panic("TestFlavorfulTestFListInVariant2") } - if ImportsFListInVariant3(Some[string]("input3")).Unwrap() != "output3" { - panic("ImportsFListInVariant3") + if TestFlavorfulTestFListInVariant3(Some[string]("input3")).Unwrap() != "output3" { + panic("TestFlavorfulTestFListInVariant3") } - if !ImportsErrnoResult().IsErr() { - panic("ImportsErrnoResult") + if !TestFlavorfulTestErrnoResult().IsErr() { + panic("TestFlavorfulTestErrnoResult") } - ImportsMyErrnoA() + TestFlavorfulTestMyErrnoA() // TODO: be able to print my_error_a - if !ImportsErrnoResult().IsOk() { - panic("ImportsErrnoResult") + if !TestFlavorfulTestErrnoResult().IsOk() { + panic("TestFlavorfulTestErrnoResult") } - t1, t2 := ImportsListTypedefs("typedef1", []string{"typedef2"}) + t1, t2 := TestFlavorfulTestListTypedefs("typedef1", []string{"typedef2"}) if len(t1) != 8 { - panic("ImportsListTypedefs") + panic("TestFlavorfulTestListTypedefs") } if len(t2) != 1 { - panic("ImportsListTypedefs") + panic("TestFlavorfulTestListTypedefs") } if t2[0] != "typedef4" { - panic("ImportsListTypedefs") + panic("TestFlavorfulTestListTypedefs") } var v2_ok Result[struct{}, struct{}] @@ -60,57 +60,57 @@ func (f FlavorfulImpl) TestImports() { var v2_err Result[struct{}, struct{}] v2_err.SetErr(struct{}{}) - v1, v2, v3 := ImportsListOfVariants( + v1, v2, v3 := TestFlavorfulTestListOfVariants( []bool{true, false}, []Result[struct{}, struct{}]{v2_ok, v2_err}, - []ImportsMyErrno{ImportsMyErrnoSuccess(), ImportsMyErrnoA()}, + []TestFlavorfulTestMyErrno{TestFlavorfulTestMyErrnoSuccess(), TestFlavorfulTestMyErrnoA()}, ) if v1[0] != false { - panic("ImportsListOfVariants") + panic("TestFlavorfulTestListOfVariants") } if v1[1] != true { - panic("ImportsListOfVariants") + panic("TestFlavorfulTestListOfVariants") } if v2[0].IsOk() { - panic("ImportsListOfVariants") + panic("TestFlavorfulTestListOfVariants") } if v2[1].IsErr() { - panic("ImportsListOfVariants") + panic("TestFlavorfulTestListOfVariants") } - if v3[0].Kind() != ImportsMyErrnoKindA { - panic("ImportsListOfVariants") + if v3[0].Kind() != TestFlavorfulTestMyErrnoKindA { + panic("TestFlavorfulTestListOfVariants") } - if v3[1].Kind() != ImportsMyErrnoKindB { - panic("ImportsListOfVariants") + if v3[1].Kind() != TestFlavorfulTestMyErrnoKindB { + panic("TestFlavorfulTestListOfVariants") } } -func (f FlavorfulImpl) FListInRecord1(a ExportsListInRecord1) { +func (f FlavorfulImpl) FListInRecord1(a ExportsTestFlavorfulTestListInRecord1) { if a.A != "list_in_record1" { panic("FListInRecord1") } } -func (f FlavorfulImpl) FListInRecord2() ExportsListInRecord2 { - return ExportsListInRecord2{"list_in_record2"} +func (f FlavorfulImpl) FListInRecord2() ExportsTestFlavorfulTestListInRecord2 { + return ExportsTestFlavorfulTestListInRecord2{"list_in_record2"} } -func (f FlavorfulImpl) FListInRecord3(a ExportsListInRecord3) ExportsListInRecord3 { +func (f FlavorfulImpl) FListInRecord3(a ExportsTestFlavorfulTestListInRecord3) ExportsTestFlavorfulTestListInRecord3 { if a.A != "list_in_record3 input" { panic("FListInRecord3") } - return ExportsListInRecord3{"list_in_record3 output"} + return ExportsTestFlavorfulTestListInRecord3{"list_in_record3 output"} } -func (f FlavorfulImpl) FListInRecord4(a ExportsListInRecord4) ExportsListInRecord4 { +func (f FlavorfulImpl) FListInRecord4(a ExportsTestFlavorfulTestListInRecord4) ExportsTestFlavorfulTestListInRecord4 { if a.A != "input4" { panic("FListInRecord4") } - return ExportsListInRecord4{"result4"} + return ExportsTestFlavorfulTestListInRecord4{"result4"} } -func (f FlavorfulImpl) FListInVariant1(a Option[string], b Result[struct{}, string], c ExportsListInVariant1V3) { +func (f FlavorfulImpl) FListInVariant1(a Option[string], b Result[struct{}, string], c ExportsTestFlavorfulTestListInVariant1V3) { if a.Unwrap() != "foo" { panic("FListInVariant1") } @@ -118,11 +118,11 @@ func (f FlavorfulImpl) FListInVariant1(a Option[string], b Result[struct{}, stri panic("FListInVariant1") } switch c.Kind() { - case ExportsListInVariant1V3KindF0: + case ExportsTestFlavorfulTestListInVariant1V3KindF0: if c.GetF0() != "baz" { panic("FListInVariant1") } - case ExportsListInVariant1V3KindF1: + case ExportsTestFlavorfulTestListInVariant1V3KindF1: panic("FListInVariant1") } } @@ -138,9 +138,9 @@ func (f FlavorfulImpl) FListInVariant3(a Option[string]) Option[string] { return Some[string]("output3") } -func (f FlavorfulImpl) ErrnoResult() Result[struct{}, ExportsMyErrno] { - var res Result[struct{}, ExportsMyErrno] - res.SetErr(ExportsMyErrnoB()) +func (f FlavorfulImpl) ErrnoResult() Result[struct{}, ExportsTestFlavorfulTestMyErrno] { + var res Result[struct{}, ExportsTestFlavorfulTestMyErrno] + res.SetErr(ExportsTestFlavorfulTestMyErrnoB()) return res } @@ -157,7 +157,7 @@ func (f FlavorfulImpl) ListTypedefs(a string, c []string) ([]uint8, []string) { return []uint8("typedef3"), []string{"typedef4"} } -func (f FlavorfulImpl) ListOfVariants(a []bool, b []Result[struct{}, struct{}], c []ExportsMyErrno) ([]bool, []Result[struct{}, struct{}], []ExportsMyErrno) { +func (f FlavorfulImpl) ListOfVariants(a []bool, b []Result[struct{}, struct{}], c []ExportsTestFlavorfulTestMyErrno) ([]bool, []Result[struct{}, struct{}], []ExportsTestFlavorfulTestMyErrno) { return a, b, c } diff --git a/tests/runtime/lists/wasm.go b/tests/runtime/lists/wasm.go index 7689ef19d..4a8b53b9a 100644 --- a/tests/runtime/lists/wasm.go +++ b/tests/runtime/lists/wasm.go @@ -8,123 +8,123 @@ import ( func init() { a := ListImpl{} SetLists(a) - SetExports(a) + SetExportsTestListsTest(a) } type ListImpl struct { } func (i ListImpl) TestImports() { - ImportsEmptyListParam([]uint8{}) - ImportsEmptyStringParam("") - res := ImportsEmptyListResult() + TestListsTestEmptyListParam([]uint8{}) + TestListsTestEmptyStringParam("") + res := TestListsTestEmptyListResult() if len(res) != 0 { - panic("ImportsEmptyListResult") + panic("TestListsTestEmptyListResult") } - res2 := ImportsEmptyStringResult() + res2 := TestListsTestEmptyStringResult() if res2 != "" { - panic("ImportsEmptyStringResult") + panic("TestListsTestEmptyStringResult") } - ImportsListParam([]uint8{1, 2, 3, 4}) - ImportsListParam2("foo") - ImportsListParam3([]string{"foo", "bar", "baz"}) - ImportsListParam4([][]string{{"foo", "bar"}, {"baz"}}) - res3 := ImportsListResult() + TestListsTestListParam([]uint8{1, 2, 3, 4}) + TestListsTestListParam2("foo") + TestListsTestListParam3([]string{"foo", "bar", "baz"}) + TestListsTestListParam4([][]string{{"foo", "bar"}, {"baz"}}) + res3 := TestListsTestListResult() if len(res3) != 5 { - panic("ImportsListResult") + panic("TestListsTestListResult") } for i := range res3 { if res3[i] != uint8(i+1) { - panic("ImportsListResult") + panic("TestListsTestListResult") } } - res4 := ImportsListResult2() + res4 := TestListsTestListResult2() if res4 != "hello!" { - panic("ImportsListResult2") + panic("TestListsTestListResult2") } - res5 := ImportsListResult3() + res5 := TestListsTestListResult3() if len(res5) != 2 { - panic("ImportsListResult3") + panic("TestListsTestListResult3") } if res5[0] != "hello," { - panic("ImportsListResult3") + panic("TestListsTestListResult3") } if res5[1] != "world!" { - panic("ImportsListResult3") + panic("TestListsTestListResult3") } - res6 := ImportsListRoundtrip([]uint8{}) + res6 := TestListsTestListRoundtrip([]uint8{}) if len(res6) != 0 { - panic("ImportsListRoundtrip") + panic("TestListsTestListRoundtrip") } - res7 := ImportsListRoundtrip([]uint8{1, 2, 3, 4, 5}) + res7 := TestListsTestListRoundtrip([]uint8{1, 2, 3, 4, 5}) if len(res7) != 5 { - panic("ImportsListRoundtrip") + panic("TestListsTestListRoundtrip") } - res8 := ImportsStringRoundtrip("") + res8 := TestListsTestStringRoundtrip("") if res8 != "" { - panic("ImportsStringRoundtrip") + panic("TestListsTestStringRoundtrip") } - res9 := ImportsStringRoundtrip("hello ⚑ world") + res9 := TestListsTestStringRoundtrip("hello ⚑ world") if res9 != "hello ⚑ world" { - panic("ImportsStringRoundtrip") + panic("TestListsTestStringRoundtrip") } - u8, i8 := ImportsListMinmax8([]uint8{0, math.MaxUint8}, []int8{math.MinInt8, math.MaxInt8}) + u8, i8 := TestListsTestListMinmax8([]uint8{0, math.MaxUint8}, []int8{math.MinInt8, math.MaxInt8}) if u8[0] != uint8(0) { - panic("ImportsListMinmax8") + panic("TestListsTestListMinmax8") } if u8[1] != math.MaxUint8 { - panic("ImportsListMinmax8") + panic("TestListsTestListMinmax8") } if i8[0] != math.MinInt8 { - panic("ImportsListMinmax8") + panic("TestListsTestListMinmax8") } if i8[1] != math.MaxInt8 { - panic("ImportsListMinmax8") + panic("TestListsTestListMinmax8") } - u16, i16 := ImportsListMinmax16([]uint16{0, math.MaxUint16}, []int16{math.MinInt16, math.MaxInt16}) + u16, i16 := TestListsTestListMinmax16([]uint16{0, math.MaxUint16}, []int16{math.MinInt16, math.MaxInt16}) if u16[0] != uint16(0) { - panic("ImportsListMinmax16") + panic("TestListsTestListMinmax16") } if u16[1] != math.MaxUint16 { - panic("ImportsListMinmax16") + panic("TestListsTestListMinmax16") } if i16[0] != math.MinInt16 { - panic("ImportsListMinmax16") + panic("TestListsTestListMinmax16") } if i16[1] != math.MaxInt16 { - panic("ImportsListMinmax16") + panic("TestListsTestListMinmax16") } - u32, i32 := ImportsListMinmax32([]uint32{0, math.MaxUint32}, []int32{math.MinInt32, math.MaxInt32}) + u32, i32 := TestListsTestListMinmax32([]uint32{0, math.MaxUint32}, []int32{math.MinInt32, math.MaxInt32}) if u32[0] != uint32(0) { - panic("ImportsListMinmax32") + panic("TestListsTestListMinmax32") } if u32[1] != math.MaxUint32 { - panic("ImportsListMinmax32") + panic("TestListsTestListMinmax32") } if i32[0] != math.MinInt32 { - panic("ImportsListMinmax32") + panic("TestListsTestListMinmax32") } if i32[1] != math.MaxInt32 { - panic("ImportsListMinmax32") + panic("TestListsTestListMinmax32") } - u64, i64 := ImportsListMinmax64([]uint64{0, math.MaxUint64}, []int64{math.MinInt64, math.MaxInt64}) + u64, i64 := TestListsTestListMinmax64([]uint64{0, math.MaxUint64}, []int64{math.MinInt64, math.MaxInt64}) if u64[0] != uint64(0) { - panic("ImportsListMinmax64") + panic("TestListsTestListMinmax64") } if u64[1] != math.MaxUint64 { - panic("ImportsListMinmax64") + panic("TestListsTestListMinmax64") } if i64[0] != math.MinInt64 { - panic("ImportsListMinmax64") + panic("TestListsTestListMinmax64") } if i64[1] != math.MaxInt64 { - panic("ImportsListMinmax64") + panic("TestListsTestListMinmax64") } } diff --git a/tests/runtime/main.rs b/tests/runtime/main.rs index 36e8f09e7..8e0950929 100644 --- a/tests/runtime/main.rs +++ b/tests/runtime/main.rs @@ -211,10 +211,7 @@ fn tests(name: &str) -> Result> { } #[cfg(feature = "go")] - if !go.is_empty() - // FIXME: needs fixing after #545 - && false - { + if !go.is_empty() { let world_name = &resolve.worlds[world].name; let out_dir = out_dir.join(format!("go-{}", world_name)); drop(fs::remove_dir_all(&out_dir)); diff --git a/tests/runtime/numbers/wasm.go b/tests/runtime/numbers/wasm.go index ce3c4e687..f89c0782c 100644 --- a/tests/runtime/numbers/wasm.go +++ b/tests/runtime/numbers/wasm.go @@ -9,7 +9,7 @@ import ( func init() { n := &NumbersImpl{} SetNumbers(n) - SetExports(n) + SetExportsTestNumbersTest(n) } type NumbersImpl struct { @@ -17,126 +17,126 @@ type NumbersImpl struct { } func (i NumbersImpl) TestImports() { - if ImportsRoundtripU8(1) != 1 { + if TestNumbersTestRoundtripU8(1) != 1 { panic("roundtrip-u8") } - if ImportsRoundtripU8(0) != 0 { + if TestNumbersTestRoundtripU8(0) != 0 { panic("roundtrip-u8") } - if ImportsRoundtripU8(math.MaxUint8) != math.MaxUint8 { + if TestNumbersTestRoundtripU8(math.MaxUint8) != math.MaxUint8 { panic("roundtrip-u8") } - if ImportsRoundtripS8(1) != 1 { + if TestNumbersTestRoundtripS8(1) != 1 { panic("roundtrip-s8") } - if ImportsRoundtripS8(math.MaxInt8) != math.MaxInt8 { + if TestNumbersTestRoundtripS8(math.MaxInt8) != math.MaxInt8 { panic("roundtrip-s8") } - if ImportsRoundtripS8(math.MinInt8) != math.MinInt8 { + if TestNumbersTestRoundtripS8(math.MinInt8) != math.MinInt8 { panic("roundtrip-s8") } - if ImportsRoundtripU16(1) != 1 { + if TestNumbersTestRoundtripU16(1) != 1 { panic("roundtrip-u16") } - if ImportsRoundtripU16(0) != 0 { + if TestNumbersTestRoundtripU16(0) != 0 { panic("roundtrip-u16") } - if ImportsRoundtripU16(math.MaxUint16) != math.MaxUint16 { + if TestNumbersTestRoundtripU16(math.MaxUint16) != math.MaxUint16 { panic("roundtrip-u16") } - if ImportsRoundtripS16(1) != 1 { + if TestNumbersTestRoundtripS16(1) != 1 { panic("roundtrip-s16") } - if ImportsRoundtripS16(math.MaxInt16) != math.MaxInt16 { + if TestNumbersTestRoundtripS16(math.MaxInt16) != math.MaxInt16 { panic("roundtrip-s16") } - if ImportsRoundtripS16(math.MinInt16) != math.MinInt16 { + if TestNumbersTestRoundtripS16(math.MinInt16) != math.MinInt16 { panic("roundtrip-s16") } - if ImportsRoundtripU32(1) != 1 { + if TestNumbersTestRoundtripU32(1) != 1 { panic("roundtrip-u32") } - if ImportsRoundtripU32(0) != 0 { + if TestNumbersTestRoundtripU32(0) != 0 { panic("roundtrip-u32") } - if ImportsRoundtripU32(math.MaxUint32) != math.MaxUint32 { + if TestNumbersTestRoundtripU32(math.MaxUint32) != math.MaxUint32 { panic("roundtrip-u32") } - if ImportsRoundtripS32(1) != 1 { + if TestNumbersTestRoundtripS32(1) != 1 { panic("roundtrip-s32") } - if ImportsRoundtripS32(math.MaxInt32) != math.MaxInt32 { + if TestNumbersTestRoundtripS32(math.MaxInt32) != math.MaxInt32 { panic("roundtrip-s32") } - if ImportsRoundtripS32(math.MinInt32) != math.MinInt32 { + if TestNumbersTestRoundtripS32(math.MinInt32) != math.MinInt32 { panic("roundtrip-s32") } - if ImportsRoundtripU64(1) != 1 { + if TestNumbersTestRoundtripU64(1) != 1 { panic("roundtrip-u64") } - if ImportsRoundtripU64(0) != 0 { + if TestNumbersTestRoundtripU64(0) != 0 { panic("roundtrip-u64") } - if ImportsRoundtripU64(math.MaxUint64) != math.MaxUint64 { + if TestNumbersTestRoundtripU64(math.MaxUint64) != math.MaxUint64 { panic("roundtrip-u64") } - if ImportsRoundtripS64(1) != 1 { + if TestNumbersTestRoundtripS64(1) != 1 { panic("roundtrip-s64") } - if ImportsRoundtripS64(math.MaxInt64) != math.MaxInt64 { + if TestNumbersTestRoundtripS64(math.MaxInt64) != math.MaxInt64 { panic("roundtrip-s64") } - if ImportsRoundtripS64(math.MinInt64) != math.MinInt64 { + if TestNumbersTestRoundtripS64(math.MinInt64) != math.MinInt64 { panic("roundtrip-s64") } - if ImportsRoundtripFloat32(1.0) != 1.0 { + if TestNumbersTestRoundtripFloat32(1.0) != 1.0 { panic("roundtrip-float32") } - if ImportsRoundtripFloat32(math.MaxFloat32) != math.MaxFloat32 { + if TestNumbersTestRoundtripFloat32(math.MaxFloat32) != math.MaxFloat32 { panic("roundtrip-float32") } - if ImportsRoundtripFloat32(math.SmallestNonzeroFloat32) != math.SmallestNonzeroFloat32 { + if TestNumbersTestRoundtripFloat32(math.SmallestNonzeroFloat32) != math.SmallestNonzeroFloat32 { panic("roundtrip-float32") } - if ImportsRoundtripFloat64(1.0) != 1.0 { + if TestNumbersTestRoundtripFloat64(1.0) != 1.0 { panic("roundtrip-float64") } - if ImportsRoundtripFloat64(math.MaxFloat64) != math.MaxFloat64 { + if TestNumbersTestRoundtripFloat64(math.MaxFloat64) != math.MaxFloat64 { panic("roundtrip-float64") } - if ImportsRoundtripFloat64(math.SmallestNonzeroFloat64) != math.SmallestNonzeroFloat64 { + if TestNumbersTestRoundtripFloat64(math.SmallestNonzeroFloat64) != math.SmallestNonzeroFloat64 { panic("roundtrip-float64") } - if !math.IsNaN(ImportsRoundtripFloat64(math.NaN())) { + if !math.IsNaN(TestNumbersTestRoundtripFloat64(math.NaN())) { panic("roundtrip-float64") } - if ImportsRoundtripChar('a') != 'a' { + if TestNumbersTestRoundtripChar('a') != 'a' { panic("roundtrip-char") } - if ImportsRoundtripChar(' ') != ' ' { + if TestNumbersTestRoundtripChar(' ') != ' ' { panic("roundtrip-char") } - if ImportsRoundtripChar('🚩') != '🚩' { + if TestNumbersTestRoundtripChar('🚩') != '🚩' { panic("roundtrip-char") } - ImportsSetScalar(2) - if ImportsGetScalar() != 2 { + TestNumbersTestSetScalar(2) + if TestNumbersTestGetScalar() != 2 { panic("get-scalar") } - ImportsSetScalar(4) - if ImportsGetScalar() != 4 { + TestNumbersTestSetScalar(4) + if TestNumbersTestGetScalar() != 4 { panic("get-scalar") } } diff --git a/tests/runtime/records/wasm.go b/tests/runtime/records/wasm.go index 85cad6127..a6a5cd808 100644 --- a/tests/runtime/records/wasm.go +++ b/tests/runtime/records/wasm.go @@ -7,59 +7,59 @@ import ( func init() { n := &RecordImpl{} SetRecords(n) - SetExports(n) + SetExportsTestRecordsTest(n) } type RecordImpl struct{} func (r *RecordImpl) TestImports() { - a, b := ImportsMultipleResults() + a, b := TestRecordsTestMultipleResults() if a != 4 && b != 5 { - panic("ImportsMultipleResults") + panic("TestRecordsTestMultipleResults") } - t := ImportsSwapTuple(ImportsTuple2U8U32T{1, 2}) + t := TestRecordsTestSwapTuple(TestRecordsTestTuple2U8U32T{1, 2}) if t.F0 != 2 && t.F1 != 1 { - panic("ImportsSwapTuple") + panic("TestRecordsTestSwapTuple") } // TODO: how to handle empty flags? - if ImportsRoundtripFlags1(ImportsF1_A) != ImportsF1_A { - panic("ImportsRoundtripFlags1") + if TestRecordsTestRoundtripFlags1(TestRecordsTestF1_A) != TestRecordsTestF1_A { + panic("TestRecordsTestRoundtripFlags1") } - if ImportsRoundtripFlags1(ImportsF1_B) != ImportsF1_B { - panic("ImportsRoundtripFlags1") + if TestRecordsTestRoundtripFlags1(TestRecordsTestF1_B) != TestRecordsTestF1_B { + panic("TestRecordsTestRoundtripFlags1") } - if ImportsRoundtripFlags1(ImportsF1_A|ImportsF1_B) != ImportsF1_A|ImportsF1_B { - panic("ImportsRoundtripFlags1") + if TestRecordsTestRoundtripFlags1(TestRecordsTestF1_A|TestRecordsTestF1_B) != TestRecordsTestF1_A|TestRecordsTestF1_B { + panic("TestRecordsTestRoundtripFlags1") } - if ImportsRoundtripFlags2(ImportsF2_C) != ImportsF2_C { - panic("ImportsRoundtripFlags2") + if TestRecordsTestRoundtripFlags2(TestRecordsTestF2_C) != TestRecordsTestF2_C { + panic("TestRecordsTestRoundtripFlags2") } - if ImportsRoundtripFlags2(ImportsF2_D) != ImportsF2_D { - panic("ImportsRoundtripFlags2") + if TestRecordsTestRoundtripFlags2(TestRecordsTestF2_D) != TestRecordsTestF2_D { + panic("TestRecordsTestRoundtripFlags2") } - if ImportsRoundtripFlags2(ImportsF2_C|ImportsF2_E) != ImportsF2_C|ImportsF2_E { - panic("ImportsRoundtripFlags2") + if TestRecordsTestRoundtripFlags2(TestRecordsTestF2_C|TestRecordsTestF2_E) != TestRecordsTestF2_C|TestRecordsTestF2_E { + panic("TestRecordsTestRoundtripFlags2") } - if a, b, c, d := ImportsRoundtripFlags3(ImportsFlag8_B0, ImportsFlag16_B1, ImportsFlag32_B2, ImportsFlag64_B3); a != ImportsFlag8_B0 && b != ImportsFlag16_B1 && c != ImportsFlag32_B2 && d != ImportsFlag64_B3 { - panic("ImportsRoundtripFlags3") + if a, b, c, d := TestRecordsTestRoundtripFlags3(TestRecordsTestFlag8_B0, TestRecordsTestFlag16_B1, TestRecordsTestFlag32_B2, TestRecordsTestFlag64_B3); a != TestRecordsTestFlag8_B0 && b != TestRecordsTestFlag16_B1 && c != TestRecordsTestFlag32_B2 && d != TestRecordsTestFlag64_B3 { + panic("TestRecordsTestRoundtripFlags3") } - r1 := ImportsRoundtripRecord1(ImportsR1{8, ImportsF1_A}) - if r1.A != 8 && r1.B != ImportsF1_A { - panic("ImportsRoundtripRecord1") + r1 := TestRecordsTestRoundtripRecord1(TestRecordsTestR1{8, TestRecordsTestF1_A}) + if r1.A != 8 && r1.B != TestRecordsTestF1_A { + panic("TestRecordsTestRoundtripRecord1") } - r2 := ImportsRoundtripRecord1(ImportsR1{0, ImportsF1_A | ImportsF1_B}) - if r2.A != 0 && r2.B != ImportsF1_A|ImportsF1_B { - panic("ImportsRoundtripRecord1") + r2 := TestRecordsTestRoundtripRecord1(TestRecordsTestR1{0, TestRecordsTestF1_A | TestRecordsTestF1_B}) + if r2.A != 0 && r2.B != TestRecordsTestF1_A|TestRecordsTestF1_B { + panic("TestRecordsTestRoundtripRecord1") } - ImportsTuple0(ImportsTuple0T{}) - if ImportsTuple1(ImportsTuple1U8T{1}).F0 != 1 { - panic("ImportsTuple0") + TestRecordsTestTuple0(TestRecordsTestTuple0T{}) + if TestRecordsTestTuple1(TestRecordsTestTuple1U8T{1}).F0 != 1 { + panic("TestRecordsTestTuple0") } } @@ -67,31 +67,31 @@ func (r *RecordImpl) MultipleResults() (uint8, uint16) { return 100, 200 } -func (r *RecordImpl) SwapTuple(a ExportsTuple2U8U32T) ExportsTuple2U32U8T { - return ExportsTuple2U32U8T{a.F1, a.F0} +func (r *RecordImpl) SwapTuple(a ExportsTestRecordsTestTuple2U8U32T) ExportsTestRecordsTestTuple2U32U8T { + return ExportsTestRecordsTestTuple2U32U8T{a.F1, a.F0} } -func (r *RecordImpl) RoundtripFlags1(a ExportsF1) ExportsF1 { +func (r *RecordImpl) RoundtripFlags1(a ExportsTestRecordsTestF1) ExportsTestRecordsTestF1 { return a } -func (r *RecordImpl) RoundtripFlags2(a ExportsF2) ExportsF2 { +func (r *RecordImpl) RoundtripFlags2(a ExportsTestRecordsTestF2) ExportsTestRecordsTestF2 { return a } -func (r *RecordImpl) RoundtripFlags3(a ExportsFlag8, b ExportsFlag16, c ExportsFlag32, d ExportsFlag64) (ExportsFlag8, ExportsFlag16, ExportsFlag32, ExportsFlag64) { +func (r *RecordImpl) RoundtripFlags3(a ExportsTestRecordsTestFlag8, b ExportsTestRecordsTestFlag16, c ExportsTestRecordsTestFlag32, d ExportsTestRecordsTestFlag64) (ExportsTestRecordsTestFlag8, ExportsTestRecordsTestFlag16, ExportsTestRecordsTestFlag32, ExportsTestRecordsTestFlag64) { return a, b, c, d } -func (r *RecordImpl) RoundtripRecord1(a ExportsR1) ExportsR1 { +func (r *RecordImpl) RoundtripRecord1(a ExportsTestRecordsTestR1) ExportsTestRecordsTestR1 { return a } -func (r *RecordImpl) Tuple0(a ExportsTuple0T) ExportsTuple0T { +func (r *RecordImpl) Tuple0(a ExportsTestRecordsTestTuple0T) ExportsTestRecordsTestTuple0T { return a } -func (r *RecordImpl) Tuple1(a ExportsTuple1U8T) ExportsTuple1U8T { +func (r *RecordImpl) Tuple1(a ExportsTestRecordsTestTuple1U8T) ExportsTestRecordsTestTuple1U8T { return a } diff --git a/tests/runtime/smoke/wasm.go b/tests/runtime/smoke/wasm.go index e8c2b6674..ff3c0c316 100644 --- a/tests/runtime/smoke/wasm.go +++ b/tests/runtime/smoke/wasm.go @@ -12,7 +12,7 @@ func init() { type SmokeImpl struct{} func (s SmokeImpl) Thunk() { - ImportsThunk() + TestSmokeImportsThunk() } func main() {} diff --git a/tests/runtime/unions/wasm.go b/tests/runtime/unions/wasm.go index d67c57375..4af15222c 100644 --- a/tests/runtime/unions/wasm.go +++ b/tests/runtime/unions/wasm.go @@ -8,346 +8,346 @@ import ( func init() { n := UnionsImpl{} SetUnions(n) - SetExports(n) + SetExportsTestUnionsTest(n) } type UnionsImpl struct{} func (s UnionsImpl) TestImports() { - res1 := ImportsAddOneInteger(ImportsAllIntegersF0(false)) + res1 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF0(false)) if res1.GetF0() != true { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res2 := ImportsAddOneInteger(ImportsAllIntegersF0(true)) + res2 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF0(true)) if res2.GetF0() != false { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res3 := ImportsAddOneInteger(ImportsAllIntegersF1(0)) + res3 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF1(0)) if res3.GetF1() != 1 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res4 := ImportsAddOneInteger(ImportsAllIntegersF1(math.MaxUint8)) + res4 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF1(math.MaxUint8)) if res4.GetF1() != 0 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res5 := ImportsAddOneInteger(ImportsAllIntegersF2(0)) + res5 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF2(0)) if res5.GetF2() != 1 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res6 := ImportsAddOneInteger(ImportsAllIntegersF2(math.MaxUint16)) + res6 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF2(math.MaxUint16)) if res6.GetF2() != 0 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res7 := ImportsAddOneInteger(ImportsAllIntegersF3(0)) + res7 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF3(0)) if res7.GetF3() != 1 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res8 := ImportsAddOneInteger(ImportsAllIntegersF3(math.MaxUint32)) + res8 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF3(math.MaxUint32)) if res8.GetF3() != 0 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res9 := ImportsAddOneInteger(ImportsAllIntegersF4(0)) + res9 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF4(0)) if res9.GetF4() != 1 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res10 := ImportsAddOneInteger(ImportsAllIntegersF4(math.MaxUint64)) + res10 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF4(math.MaxUint64)) if res10.GetF4() != 0 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res11 := ImportsAddOneInteger(ImportsAllIntegersF5(0)) + res11 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF5(0)) if res11.GetF5() != 1 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res12 := ImportsAddOneInteger(ImportsAllIntegersF5(math.MaxInt8)) + res12 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF5(math.MaxInt8)) if res12.GetF5() != math.MinInt8 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res13 := ImportsAddOneInteger(ImportsAllIntegersF6(0)) + res13 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF6(0)) if res13.GetF6() != 1 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res14 := ImportsAddOneInteger(ImportsAllIntegersF6(math.MaxInt16)) + res14 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF6(math.MaxInt16)) if res14.GetF6() != math.MinInt16 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res15 := ImportsAddOneInteger(ImportsAllIntegersF7(0)) + res15 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF7(0)) if res15.GetF7() != 1 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res16 := ImportsAddOneInteger(ImportsAllIntegersF7(math.MaxInt32)) + res16 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF7(math.MaxInt32)) if res16.GetF7() != math.MinInt32 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res17 := ImportsAddOneInteger(ImportsAllIntegersF8(0)) + res17 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF8(0)) if res17.GetF8() != 1 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } - res18 := ImportsAddOneInteger(ImportsAllIntegersF8(math.MaxInt64)) + res18 := TestUnionsTestAddOneInteger(TestUnionsTestAllIntegersF8(math.MaxInt64)) if res18.GetF8() != math.MinInt64 { - panic("unexpect result in ImportsAddOneInteger") + panic("unexpect result in TestUnionsTestAddOneInteger") } // All Floats - res19 := ImportsAddOneFloat(ImportsAllFloatsF0(0.0)) + res19 := TestUnionsTestAddOneFloat(TestUnionsTestAllFloatsF0(0.0)) if res19.GetF0() != 1.0 { - panic("unexpect result in ImportsAddOneFloat") + panic("unexpect result in TestUnionsTestAddOneFloat") } - res20 := ImportsAddOneFloat(ImportsAllFloatsF1(0.0)) + res20 := TestUnionsTestAddOneFloat(TestUnionsTestAllFloatsF1(0.0)) if res20.GetF1() != 1.0 { - panic("unexpect result in ImportsAddOneFloat") + panic("unexpect result in TestUnionsTestAddOneFloat") } // All Text - if ImportsReplaceFirstChar(ImportsAllTextF0('a'), 'z').GetF0() != 'z' { - panic("unexpect result in ImportsReplaceFirstChar") + if TestUnionsTestReplaceFirstChar(TestUnionsTestAllTextF0('a'), 'z').GetF0() != 'z' { + panic("unexpect result in TestUnionsTestReplaceFirstChar") } - if ImportsReplaceFirstChar(ImportsAllTextF1("abc"), 'z').GetF1() != "zbc" { - panic("unexpect result in ImportsReplaceFirstChar") + if TestUnionsTestReplaceFirstChar(TestUnionsTestAllTextF1("abc"), 'z').GetF1() != "zbc" { + panic("unexpect result in TestUnionsTestReplaceFirstChar") } // All Integers - if ImportsIdentifyInteger(ImportsAllIntegersF0(true)) != 0 { - panic("unexpect result in ImportsIdentifyInteger") + if TestUnionsTestIdentifyInteger(TestUnionsTestAllIntegersF0(true)) != 0 { + panic("unexpect result in TestUnionsTestIdentifyInteger") } - if ImportsIdentifyInteger(ImportsAllIntegersF1(0)) != 1 { - panic("unexpect result in ImportsIdentifyInteger") + if TestUnionsTestIdentifyInteger(TestUnionsTestAllIntegersF1(0)) != 1 { + panic("unexpect result in TestUnionsTestIdentifyInteger") } - if ImportsIdentifyInteger(ImportsAllIntegersF2(0)) != 2 { - panic("unexpect result in ImportsIdentifyInteger") + if TestUnionsTestIdentifyInteger(TestUnionsTestAllIntegersF2(0)) != 2 { + panic("unexpect result in TestUnionsTestIdentifyInteger") } - if ImportsIdentifyInteger(ImportsAllIntegersF3(0)) != 3 { - panic("unexpect result in ImportsIdentifyInteger") + if TestUnionsTestIdentifyInteger(TestUnionsTestAllIntegersF3(0)) != 3 { + panic("unexpect result in TestUnionsTestIdentifyInteger") } - if ImportsIdentifyInteger(ImportsAllIntegersF4(0)) != 4 { - panic("unexpect result in ImportsIdentifyInteger") + if TestUnionsTestIdentifyInteger(TestUnionsTestAllIntegersF4(0)) != 4 { + panic("unexpect result in TestUnionsTestIdentifyInteger") } - if ImportsIdentifyInteger(ImportsAllIntegersF5(0)) != 5 { - panic("unexpect result in ImportsIdentifyInteger") + if TestUnionsTestIdentifyInteger(TestUnionsTestAllIntegersF5(0)) != 5 { + panic("unexpect result in TestUnionsTestIdentifyInteger") } - if ImportsIdentifyInteger(ImportsAllIntegersF6(0)) != 6 { - panic("unexpect result in ImportsIdentifyInteger") + if TestUnionsTestIdentifyInteger(TestUnionsTestAllIntegersF6(0)) != 6 { + panic("unexpect result in TestUnionsTestIdentifyInteger") } - if ImportsIdentifyInteger(ImportsAllIntegersF7(0)) != 7 { - panic("unexpect result in ImportsIdentifyInteger") + if TestUnionsTestIdentifyInteger(TestUnionsTestAllIntegersF7(0)) != 7 { + panic("unexpect result in TestUnionsTestIdentifyInteger") } - if ImportsIdentifyInteger(ImportsAllIntegersF8(0)) != 8 { - panic("unexpect result in ImportsIdentifyInteger") + if TestUnionsTestIdentifyInteger(TestUnionsTestAllIntegersF8(0)) != 8 { + panic("unexpect result in TestUnionsTestIdentifyInteger") } - if ImportsIdentifyFloat(ImportsAllFloatsF0(0.0)) != 0 { - panic("unexpect result in ImportsIdentifyFloat") + if TestUnionsTestIdentifyFloat(TestUnionsTestAllFloatsF0(0.0)) != 0 { + panic("unexpect result in TestUnionsTestIdentifyFloat") } - if ImportsIdentifyFloat(ImportsAllFloatsF1(0.0)) != 1 { - panic("unexpect result in ImportsIdentifyFloat") + if TestUnionsTestIdentifyFloat(TestUnionsTestAllFloatsF1(0.0)) != 1 { + panic("unexpect result in TestUnionsTestIdentifyFloat") } // All Text - if ImportsIdentifyText(ImportsAllTextF0('a')) != 0 { - panic("unexpected result in ImportsIdentifyText") + if TestUnionsTestIdentifyText(TestUnionsTestAllTextF0('a')) != 0 { + panic("unexpected result in TestUnionsTestIdentifyText") } - if ImportsIdentifyText(ImportsAllTextF1("abc")) != 1 { - panic("unexpected result in ImportsIdentifyText") + if TestUnionsTestIdentifyText(TestUnionsTestAllTextF1("abc")) != 1 { + panic("unexpected result in TestUnionsTestIdentifyText") } // All Duplicated - res21 := ImportsAddOneDuplicated(ImportsDuplicatedS32F0(0)) + res21 := TestUnionsTestAddOneDuplicated(TestUnionsTestDuplicatedS32F0(0)) if res21.GetF0() != 1 { - panic("unexpected result in ImportsAddOneDuplicated") + panic("unexpected result in TestUnionsTestAddOneDuplicated") } - res22 := ImportsAddOneDuplicated(ImportsDuplicatedS32F1(1)) + res22 := TestUnionsTestAddOneDuplicated(TestUnionsTestDuplicatedS32F1(1)) if res22.GetF1() != 2 { - panic("unexpected result in ImportsAddOneDuplicated") + panic("unexpected result in TestUnionsTestAddOneDuplicated") } - res23 := ImportsAddOneDuplicated(ImportsDuplicatedS32F2(2)) + res23 := TestUnionsTestAddOneDuplicated(TestUnionsTestDuplicatedS32F2(2)) if res23.GetF2() != 3 { - panic("unexpected result in ImportsAddOneDuplicated") + panic("unexpected result in TestUnionsTestAddOneDuplicated") } // Distinguishable - if ImportsAddOneDistinguishableNum(ImportsDistinguishableNumF1(0)).GetF1() != 1 { - panic("unexpect result in ImportsAddOneDistinguishableNum") + if TestUnionsTestAddOneDistinguishableNum(TestUnionsTestDistinguishableNumF1(0)).GetF1() != 1 { + panic("unexpect result in TestUnionsTestAddOneDistinguishableNum") } - if ImportsIdentifyDistinguishableNum(ImportsDistinguishableNumF0(0.0)) != 0 { - panic("unexpect result in ImportsIdentifyDistinguishableNum") + if TestUnionsTestIdentifyDistinguishableNum(TestUnionsTestDistinguishableNumF0(0.0)) != 0 { + panic("unexpect result in TestUnionsTestIdentifyDistinguishableNum") } - if ImportsIdentifyDistinguishableNum(ImportsDistinguishableNumF1(1)) != 1 { - panic("unexpect result in ImportsIdentifyDistinguishableNum") + if TestUnionsTestIdentifyDistinguishableNum(TestUnionsTestDistinguishableNumF1(1)) != 1 { + panic("unexpect result in TestUnionsTestIdentifyDistinguishableNum") } } -func (u UnionsImpl) AddOneInteger(num ExportsAllIntegers) ExportsAllIntegers { +func (u UnionsImpl) AddOneInteger(num ExportsTestUnionsTestAllIntegers) ExportsTestUnionsTestAllIntegers { switch num.Kind() { - case ExportsAllIntegersKindF0: - return ExportsAllIntegersF0(!num.GetF0()) - case ExportsAllIntegersKindF1: - return ExportsAllIntegersF1(num.GetF1() + 1) - case ExportsAllIntegersKindF2: - return ExportsAllIntegersF2(num.GetF2() + 1) - case ExportsAllIntegersKindF3: - return ExportsAllIntegersF3(num.GetF3() + 1) - case ExportsAllIntegersKindF4: - return ExportsAllIntegersF4(num.GetF4() + 1) - case ExportsAllIntegersKindF5: - return ExportsAllIntegersF5(num.GetF5() + 1) - case ExportsAllIntegersKindF6: - return ExportsAllIntegersF6(num.GetF6() + 1) - case ExportsAllIntegersKindF7: - return ExportsAllIntegersF7(num.GetF7() + 1) - case ExportsAllIntegersKindF8: - return ExportsAllIntegersF8(num.GetF8() + 1) + case ExportsTestUnionsTestAllIntegersKindF0: + return ExportsTestUnionsTestAllIntegersF0(!num.GetF0()) + case ExportsTestUnionsTestAllIntegersKindF1: + return ExportsTestUnionsTestAllIntegersF1(num.GetF1() + 1) + case ExportsTestUnionsTestAllIntegersKindF2: + return ExportsTestUnionsTestAllIntegersF2(num.GetF2() + 1) + case ExportsTestUnionsTestAllIntegersKindF3: + return ExportsTestUnionsTestAllIntegersF3(num.GetF3() + 1) + case ExportsTestUnionsTestAllIntegersKindF4: + return ExportsTestUnionsTestAllIntegersF4(num.GetF4() + 1) + case ExportsTestUnionsTestAllIntegersKindF5: + return ExportsTestUnionsTestAllIntegersF5(num.GetF5() + 1) + case ExportsTestUnionsTestAllIntegersKindF6: + return ExportsTestUnionsTestAllIntegersF6(num.GetF6() + 1) + case ExportsTestUnionsTestAllIntegersKindF7: + return ExportsTestUnionsTestAllIntegersF7(num.GetF7() + 1) + case ExportsTestUnionsTestAllIntegersKindF8: + return ExportsTestUnionsTestAllIntegersF8(num.GetF8() + 1) default: - panic("unexpected type in ExportsAllIntegers") + panic("unexpected type in ExportsTestUnionsTestAllIntegers") } } -func (u UnionsImpl) AddOneFloat(num ExportsAllFloats) ExportsAllFloats { +func (u UnionsImpl) AddOneFloat(num ExportsTestUnionsTestAllFloats) ExportsTestUnionsTestAllFloats { switch num.Kind() { - case ExportsAllFloatsKindF0: - return ExportsAllFloatsF0(num.GetF0() + 1.0) - case ExportsAllFloatsKindF1: - return ExportsAllFloatsF1(num.GetF1() + 1.0) + case ExportsTestUnionsTestAllFloatsKindF0: + return ExportsTestUnionsTestAllFloatsF0(num.GetF0() + 1.0) + case ExportsTestUnionsTestAllFloatsKindF1: + return ExportsTestUnionsTestAllFloatsF1(num.GetF1() + 1.0) default: - panic("unexpected type in ExportsAllFloats") + panic("unexpected type in ExportsTestUnionsTestAllFloats") } } -func (u UnionsImpl) ReplaceFirstChar(text ExportsAllText, letter rune) ExportsAllText { +func (u UnionsImpl) ReplaceFirstChar(text ExportsTestUnionsTestAllText, letter rune) ExportsTestUnionsTestAllText { switch text.Kind() { - case ExportsAllTextKindF0: - return ExportsAllTextF0(letter) - case ExportsAllTextKindF1: - return ExportsAllTextF1(string(letter) + text.GetF1()[1:]) + case ExportsTestUnionsTestAllTextKindF0: + return ExportsTestUnionsTestAllTextF0(letter) + case ExportsTestUnionsTestAllTextKindF1: + return ExportsTestUnionsTestAllTextF1(string(letter) + text.GetF1()[1:]) default: // handle error or panic - return ExportsAllText{} + return ExportsTestUnionsTestAllText{} } } -func (u UnionsImpl) IdentifyInteger(num ExportsAllIntegers) uint8 { +func (u UnionsImpl) IdentifyInteger(num ExportsTestUnionsTestAllIntegers) uint8 { switch num.Kind() { - case ExportsAllIntegersKindF0: + case ExportsTestUnionsTestAllIntegersKindF0: return 0 - case ExportsAllIntegersKindF1: + case ExportsTestUnionsTestAllIntegersKindF1: return 1 - case ExportsAllIntegersKindF2: + case ExportsTestUnionsTestAllIntegersKindF2: return 2 - case ExportsAllIntegersKindF3: + case ExportsTestUnionsTestAllIntegersKindF3: return 3 - case ExportsAllIntegersKindF4: + case ExportsTestUnionsTestAllIntegersKindF4: return 4 - case ExportsAllIntegersKindF5: + case ExportsTestUnionsTestAllIntegersKindF5: return 5 - case ExportsAllIntegersKindF6: + case ExportsTestUnionsTestAllIntegersKindF6: return 6 - case ExportsAllIntegersKindF7: + case ExportsTestUnionsTestAllIntegersKindF7: return 7 - case ExportsAllIntegersKindF8: + case ExportsTestUnionsTestAllIntegersKindF8: return 8 default: - panic("unexpected type in ExportsAllIntegers") + panic("unexpected type in ExportsTestUnionsTestAllIntegers") } } -func (u UnionsImpl) IdentifyFloat(num ExportsAllFloats) uint8 { +func (u UnionsImpl) IdentifyFloat(num ExportsTestUnionsTestAllFloats) uint8 { switch num.Kind() { - case ExportsAllFloatsKindF0: + case ExportsTestUnionsTestAllFloatsKindF0: return 0 - case ExportsAllFloatsKindF1: + case ExportsTestUnionsTestAllFloatsKindF1: return 1 default: - panic("unexpected type in ExportsAllFloats") + panic("unexpected type in ExportsTestUnionsTestAllFloats") } } -func (u UnionsImpl) IdentifyText(text ExportsAllText) uint8 { +func (u UnionsImpl) IdentifyText(text ExportsTestUnionsTestAllText) uint8 { switch text.Kind() { - case ExportsAllTextKindF0: + case ExportsTestUnionsTestAllTextKindF0: return 0 - case ExportsAllTextKindF1: + case ExportsTestUnionsTestAllTextKindF1: return 1 default: - panic("unexpected type in ExportsAllText") + panic("unexpected type in ExportsTestUnionsTestAllText") } } -func (u UnionsImpl) AddOneDuplicated(num ExportsDuplicatedS32) ExportsDuplicatedS32 { +func (u UnionsImpl) AddOneDuplicated(num ExportsTestUnionsTestDuplicatedS32) ExportsTestUnionsTestDuplicatedS32 { switch num.Kind() { - case ExportsDuplicatedS32KindF0: - return ExportsDuplicatedS32F0(num.GetF0() + 1) - case ExportsDuplicatedS32KindF1: - return ExportsDuplicatedS32F1(num.GetF1() + 1) - case ExportsDuplicatedS32KindF2: - return ExportsDuplicatedS32F2(num.GetF2() + 1) + case ExportsTestUnionsTestDuplicatedS32KindF0: + return ExportsTestUnionsTestDuplicatedS32F0(num.GetF0() + 1) + case ExportsTestUnionsTestDuplicatedS32KindF1: + return ExportsTestUnionsTestDuplicatedS32F1(num.GetF1() + 1) + case ExportsTestUnionsTestDuplicatedS32KindF2: + return ExportsTestUnionsTestDuplicatedS32F2(num.GetF2() + 1) default: - panic("unexpected type in ExportsDuplicatedS32") + panic("unexpected type in ExportsTestUnionsTestDuplicatedS32") } } -func (u UnionsImpl) IdentifyDuplicated(num ExportsDuplicatedS32) uint8 { +func (u UnionsImpl) IdentifyDuplicated(num ExportsTestUnionsTestDuplicatedS32) uint8 { switch num.Kind() { - case ExportsDuplicatedS32KindF0: + case ExportsTestUnionsTestDuplicatedS32KindF0: return 0 - case ExportsDuplicatedS32KindF1: + case ExportsTestUnionsTestDuplicatedS32KindF1: return 1 - case ExportsDuplicatedS32KindF2: + case ExportsTestUnionsTestDuplicatedS32KindF2: return 2 default: panic("unexpected type in IdentifyDuplicated") } } -func (u UnionsImpl) AddOneDistinguishableNum(num ExportsDistinguishableNum) ExportsDistinguishableNum { +func (u UnionsImpl) AddOneDistinguishableNum(num ExportsTestUnionsTestDistinguishableNum) ExportsTestUnionsTestDistinguishableNum { switch num.Kind() { - case ExportsDistinguishableNumKindF0: - return ExportsDistinguishableNumF0(num.GetF0() + 1.0) - case ExportsDistinguishableNumKindF1: - return ExportsDistinguishableNumF1(num.GetF1() + 1) + case ExportsTestUnionsTestDistinguishableNumKindF0: + return ExportsTestUnionsTestDistinguishableNumF0(num.GetF0() + 1.0) + case ExportsTestUnionsTestDistinguishableNumKindF1: + return ExportsTestUnionsTestDistinguishableNumF1(num.GetF1() + 1) default: - panic("unexpected type in ExportsDistinguishableNum") + panic("unexpected type in ExportsTestUnionsTestDistinguishableNum") } } -func (u UnionsImpl) IdentifyDistinguishableNum(num ExportsDistinguishableNum) uint8 { +func (u UnionsImpl) IdentifyDistinguishableNum(num ExportsTestUnionsTestDistinguishableNum) uint8 { switch num.Kind() { - case ExportsDistinguishableNumKindF0: + case ExportsTestUnionsTestDistinguishableNumKindF0: return 0 - case ExportsDistinguishableNumKindF1: + case ExportsTestUnionsTestDistinguishableNumKindF1: return 1 default: - panic("unexpected type in ExportsDistinguishableNum") + panic("unexpected type in ExportsTestUnionsTestDistinguishableNum") } }