@@ -48,25 +48,23 @@ TEST(capi, get_function_type)
4848
4949 const auto type0 = fizzy_get_function_type (module , 0 );
5050 EXPECT_EQ (type0.inputs_size , 0 );
51- EXPECT_EQ (type0.outputs_size , 0 );
51+ EXPECT_EQ (type0.output , FizzyValueTypeVoid );
5252
5353 const auto type1 = fizzy_get_function_type (module , 1 );
5454 EXPECT_EQ (type1.inputs_size , 2 );
5555 EXPECT_EQ (type1.inputs [0 ], FizzyValueTypeI32);
5656 EXPECT_EQ (type1.inputs [1 ], FizzyValueTypeI32);
57- EXPECT_EQ (type1.outputs_size , 1 );
58- EXPECT_EQ (type1.outputs [0 ], FizzyValueTypeI32);
57+ EXPECT_EQ (type1.output , FizzyValueTypeI32);
5958
6059 const auto type2 = fizzy_get_function_type (module , 2 );
6160 EXPECT_EQ (type2.inputs_size , 1 );
6261 EXPECT_EQ (type2.inputs [0 ], FizzyValueTypeI64);
63- EXPECT_EQ (type2.outputs_size , 0 );
62+ EXPECT_EQ (type2.output , FizzyValueTypeVoid );
6463
6564 const auto type3 = fizzy_get_function_type (module , 3 );
6665 EXPECT_EQ (type3.inputs_size , 1 );
6766 EXPECT_EQ (type3.inputs [0 ], FizzyValueTypeF64);
68- EXPECT_EQ (type3.outputs_size , 1 );
69- EXPECT_EQ (type3.outputs [0 ], FizzyValueTypeF32);
67+ EXPECT_EQ (type3.output , FizzyValueTypeF32);
7068
7169 fizzy_free_module (module );
7270}
@@ -126,9 +124,7 @@ TEST(capi, instantiate_imported_function)
126124 module = fizzy_parse (wasm.data (), wasm.size ());
127125 ASSERT_NE (module , nullptr );
128126
129- const auto output = FizzyValueTypeI32;
130-
131- FizzyExternalFunction host_funcs[] = {{{nullptr , 0 , &output, 1 },
127+ FizzyExternalFunction host_funcs[] = {{{FizzyValueTypeI32, nullptr , 0 },
132128 [](void *, FizzyInstance*, const FizzyValue*, int ) {
133129 return FizzyExecutionResult{false , true , {42 }};
134130 },
@@ -252,14 +248,13 @@ TEST(capi, execute_with_host_function)
252248 ASSERT_NE (module , nullptr );
253249
254250 const FizzyValueType inputs[] = {FizzyValueTypeI32, FizzyValueTypeI32};
255- const FizzyValueType output = FizzyValueTypeI32;
256251
257- FizzyExternalFunction host_funcs[] = {{{nullptr , 0 , &output, 1 },
252+ FizzyExternalFunction host_funcs[] = {{{FizzyValueTypeI32, nullptr , 0 },
258253 [](void *, FizzyInstance*, const FizzyValue*, int ) {
259254 return FizzyExecutionResult{false , true , {42 }};
260255 },
261256 nullptr },
262- {{&inputs[0 ], 2 , &output, 1 },
257+ {{FizzyValueTypeI32, &inputs[0 ], 2 },
263258 [](void *, FizzyInstance*, const FizzyValue* args, int ) {
264259 return FizzyExecutionResult{false , true , {args[0 ].i64 / args[1 ].i64 }};
265260 },
@@ -289,9 +284,7 @@ TEST(capi, imported_function_traps)
289284 auto module = fizzy_parse (wasm.data (), wasm.size ());
290285 ASSERT_NE (module , nullptr );
291286
292- const FizzyValueType output = FizzyValueTypeI32;
293-
294- FizzyExternalFunction host_funcs[] = {{{nullptr , 0 , &output, 1 },
287+ FizzyExternalFunction host_funcs[] = {{{FizzyValueTypeI32, nullptr , 0 },
295288 [](void *, FizzyInstance*, const FizzyValue*, int ) {
296289 return FizzyExecutionResult{true , false , {}};
297290 },
@@ -384,9 +377,8 @@ TEST(capi, imported_function_from_another_module)
384377 };
385378
386379 const FizzyValueType inputs[] = {FizzyValueTypeI32, FizzyValueTypeI32};
387- const FizzyValueType output = FizzyValueTypeI32;
388380
389- FizzyExternalFunction host_funcs[] = {{{&inputs[0 ], 2 , &output, 1 }, sub, &host_context}};
381+ FizzyExternalFunction host_funcs[] = {{{FizzyValueTypeI32, &inputs[0 ], 2 }, sub, &host_context}};
390382
391383 auto instance2 = fizzy_instantiate (module2, host_funcs, 1 );
392384 ASSERT_NE (instance2, nullptr );
0 commit comments