-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get the ball rolling on writing tests
Separate loading story file and starting state server. Add test for op_add
- Loading branch information
Showing
6 changed files
with
34 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
defmodule OpcodeTest do | ||
alias Xyzzy.Machine.OpFuncs | ||
alias Xyzzy.Machine.OpInfo | ||
alias Xyzzy.Machine.State | ||
|
||
use ExUnit.Case | ||
doctest Xyzzy | ||
|
||
setup do | ||
{:ok, _pid} = State.Registry.start_link | ||
{:ok, _pid} = State.Supervisor.start_link | ||
:ok | ||
end | ||
|
||
test "op_add" do | ||
info = %OpInfo{operands: [2, 2], | ||
next_pc: 0xBEEF, | ||
return_store: 0x02} | ||
|
||
state = %State{locals: %{2 => 0}} | ||
State.Supervisor.start_game(state, "op_add_test") | ||
|
||
OpFuncs.op_add("op_add_test", info) | ||
|
||
state = State.Server.get_state("op_add_test") | ||
|
||
assert state.pc == 0xBEEF | ||
assert state.locals |> Map.get(2) == 4 | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.