   end
 
   test "find_home", %{shim: shim} do
-    :ok = shim_fun_ok(shim)
+    :ok = simulate_syscall(shim)
     assert :ok = SysCalls.find_home(TestSysCalls, "x")
     assert_receive {:find_home, ["x"]}
 
-    :ok = shim_fun_error(shim, "home lost")
+    :ok = simulate_syscall_error(shim, "home lost")
 
     assert {:error, "home lost"} == SysCalls.find_home(TestSysCalls, "x")
   end
 
   test "execute_script", %{shim: shim} do
-    :ok = shim_fun_ok(shim)
+    :ok = simulate_syscall(shim)
     assert :ok = SysCalls.execute_script(TestSysCalls, "take-photo", %{})
     assert_receive {:execute_script, ["take-photo", %{}]}
 
-    :ok = shim_fun_error(shim, "not installed")
+    :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 = shim_fun_ok(shim)
+    :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 = shim_fun_error(shim, "boom")
+    :ok = simulate_syscall_error(shim, "boom")
 
     assert {:error, "boom"} ==
              SysCalls.set_servo_angle(TestSysCalls, "set_servo_angle", arg1)

    assert_receive {:write_pin, [%{type: "boxled", id: 4}, 0, 1]}
    assert_receive {:write_pin, [%{type: "boxled", id: 3}, 1, 123]}

    :ok = shim_fun_error(shim, "firmware error")

    assert {:error, "firmware error"} ==
             SysCalls.write_pin(TestSysCalls, 1, 0, 1)
  end

  test "read_pin", %{shim: shim} do
    :ok = shim_fun_ok(shim, 1)
    assert 1 == SysCalls.read_pin(TestSysCalls, 10, 0)
    assert 1 == SysCalls.read_pin(TestSysCalls, 77, nil)
    assert_receive {:read_pin, [10, 0]}
    assert_receive {:read_pin, [77, nil]}

    :ok = shim_fun_error(shim, "firmware error")

    assert {:error, "firmware error"} == SysCalls.read_pin(TestSysCalls, 1, 0)
  end

  test "wait", %{shim: shim} do
    :ok = shim_fun_ok(shim)
    assert :ok = SysCalls.wait(TestSysCalls, 1000)
    assert_receive {:wait, [1000]}
  end

  test "named_pin", %{shim: shim} do
    # Peripheral and Sensor are on the Arduino
    :ok = shim_fun_ok(shim, 44)
    assert 44 == SysCalls.named_pin(TestSysCalls, "Peripheral", 5)
    assert 44 == SysCalls.named_pin(TestSysCalls, "Sensor", 1999)

    # BoxLed is on the GPIO
    :ok = shim_fun_ok(shim, %{type: "BoxLed", id: 3})

    assert %{type: "BoxLed", id: 3} ==
             SysCalls.named_pin(TestSysCalls, "BoxLed", 3)

    :ok = shim_fun_ok(shim, %{type: "BoxLed", id: 4})

    assert %{type: "BoxLed", id: 4} ==
             SysCalls.named_pin(TestSysCalls, "BoxLed", 4)

  end

  test "point", %{shim: shim} do
    :ok = simulate_syscall(shim, %{x: 100, y: 200, z: 300})

    assert %{x: 100, y: 200, z: 300} =
             SysCalls.point(TestSysCalls, "Peripheral", 1)

    assert_receive {:point, ["Peripheral", 1]}

    :ok = simulate_syscall_error(shim, "point error")

    assert {:error, "point error"} ==
             SysCalls.point(TestSysCalls, "Peripheral", 1)
  end

  test "point groups", %{shim: shim} do
    :ok = simulate_syscall(shim, %{x: 100, y: 200, z: 300})

    assert %{x: 100, y: 200, z: 300} =
             SysCalls.point(TestSysCalls, "Peripheral", 1)

    assert_receive {:point, ["Peripheral", 1]}

    :ok = simulate_syscall_error(shim, "point error")

    assert {:error, "point error"} ==
             SysCalls.point(TestSysCalls, "Peripheral", 1)
  end

  test "move_absolute", %{shim: shim} do
    :ok = simulate_syscall(shim)
    assert :ok = SysCalls.move_absolute(TestSysCalls, 1, 2, 3, 4)
    assert_receive {:move_absolute, [1, 2, 3, 4]}

    :ok = simulate_syscall_error(shim, "move failed!")

    assert {:error, "move failed!"} ==
             SysCalls.move_absolute(TestSysCalls, 1, 2, 3, 4)
  end

  test "get current positions", %{shim: shim} do
    :ok = simulate_syscall(shim, 100.00)
    assert 100.00 = SysCalls.get_current_x(TestSysCalls)
    assert 100.00 = SysCalls.get_current_y(TestSysCalls)
    assert 100.00 = SysCalls.get_current_z(TestSysCalls)
