diff --git a/test/components/component_test.exs b/test/components/component_test.exs index 79376ae..35ab28a 100644 --- a/test/components/component_test.exs +++ b/test/components/component_test.exs @@ -1,9 +1,6 @@ defmodule Wasmex.WasmComponentsTest do use ExUnit.Case, async: true - alias Wasmex.Engine - alias Wasmex.EngineConfig - test "invoke component func" do {:ok, store} = Wasmex.Components.Store.new_wasi() component_bytes = File.read!("test/component_fixtures/hello_world/hello_world.wasm") diff --git a/test/components/component_types_test.exs b/test/components/component_types_test.exs index 05e04cd..79b3ab6 100644 --- a/test/components/component_types_test.exs +++ b/test/components/component_types_test.exs @@ -1,9 +1,6 @@ defmodule Wasm.Components.ComponentTypesTest do use ExUnit.Case, async: true - alias Wasmex.Engine - alias Wasmex.EngineConfig - setup do {:ok, store} = Wasmex.Components.Store.new() component_bytes = File.read!("test/component_fixtures/component_types/component_types.wasm") @@ -29,8 +26,10 @@ defmodule Wasm.Components.ComponentTypesTest do test "floats", %{instance: instance} do pi = 3.14592 - assert {:ok, pi} = Wasmex.Components.Instance.call_function(instance, "id-f32", [pi]) - assert {:ok, pi} = Wasmex.Components.Instance.call_function(instance, "id-f64", [pi]) + assert {:ok, pi_result} = Wasmex.Components.Instance.call_function(instance, "id-f32", [pi]) + assert_in_delta(pi, pi_result, 1.0e-5) + assert {:ok, pi_result} = Wasmex.Components.Instance.call_function(instance, "id-f64", [pi]) + assert_in_delta(pi, pi_result, 1.0e-5) end test "records", %{instance: instance} do diff --git a/test/components/components_test.exs b/test/components/components_test.exs index 77d6de5..db87d82 100644 --- a/test/components/components_test.exs +++ b/test/components/components_test.exs @@ -6,7 +6,7 @@ defmodule Wasmex.ComponentsTest do component_bytes = File.read!("test/component_fixtures/component_types/component_types.wasm") component_pid = start_supervised!({Wasmex.Components, %{bytes: component_bytes}}) assert {:ok, "mom"} = Wasmex.Components.call_function(component_pid, "id-string", ["mom"]) - assert {:error, error} = Wasmex.Components.call_function(component_pid, "garbage", ["wut"]) + assert {:error, _error} = Wasmex.Components.call_function(component_pid, "garbage", ["wut"]) end test "wasi interaction" do @@ -17,8 +17,7 @@ defmodule Wasmex.ComponentsTest do {Wasmex.Components, %{bytes: component_bytes, wasi: %WasiP2Options{allow_http: true}}} ) - assert {:ok, time} = - assert({:ok, time} = Wasmex.Components.call_function(component_pid, "get-time", [])) + assert {:ok, time} = Wasmex.Components.call_function(component_pid, "get-time", []) assert time =~ Date.utc_today() |> Date.to_iso8601() end diff --git a/test/components/wasi_test.exs b/test/components/wasi_test.exs index 0991d4e..0339e54 100644 --- a/test/components/wasi_test.exs +++ b/test/components/wasi_test.exs @@ -1,8 +1,6 @@ defmodule Wasmex.Components.WasiTest do use ExUnit.Case, async: true - alias Wasmex.Engine - alias Wasmex.EngineConfig alias Wasmex.Wasi.WasiP2Options test "outbound http call" do