   end
 
   test "write_pin", %{shim: shim} do
-    :ok = shim_fun_ok(shim)
+    :ok = simulate_syscall(shim)
     assert :ok = SysCalls.write_pin(TestSysCalls, 1, 0, 1)
 
     assert :ok =

    assert %{} = SysCalls.get_sequence(TestSysCalls, 123)
    assert_receive {:get_sequence, [123]}

    :ok = shim_fun_error(shim, "sequence not found")

    assert {:error, "sequence not found"} ==
             SysCalls.get_sequence(TestSysCalls, 123)
  end

  def shim_fun_ok(shim, val \\ :ok) do
    pid = self()

    :ok =

  end

  test "find_home", %{shim: shim} do
    :ok = simulate_syscall(shim)
    assert :ok = SysCalls.find_home(TestSysCalls, "x")
    assert_receive {:find_home, ["x"]}

    :ok = simulate_syscall_error(shim, "home lost")

    assert {:error, "home lost"} == SysCalls.find_home(TestSysCalls, "x")
  end

  test "execute_script", %{shim: shim} do
    :ok = simulate_syscall(shim)
    assert :ok = SysCalls.execute_script(TestSysCalls, "take-photo", %{})
    assert_receive {:execute_script, ["take-photo", %{}]}

    :ok = simulate_syscall_error(shim, "not installed")

    assert {:error, "not installed"} ==
             SysCalls.execute_script(TestSysCalls, "take-photo", %{})
  end

  test "set_servo_angle errors", %{shim: shim} do
    :ok = simulate_syscall(shim)
    arg0 = [5, 40]
    assert :ok = SysCalls.set_servo_angle(TestSysCalls, "set_servo_angle", arg0)
    assert_receive {:set_servo_angle, arg0}

    arg1 = [40, -5]
    :ok = simulate_syscall_error(shim, "boom")

    assert {:error, "boom"} ==
             SysCalls.set_servo_angle(TestSysCalls, "set_servo_angle", arg1)
