Skip to content

Commit

Permalink
Add command names lookup list
Browse files Browse the repository at this point in the history
  • Loading branch information
Askaholic committed Apr 25, 2021
1 parent 419a96e commit 1963778
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "faf-replay-parser-python"
description = "Python bindings for faf-replay-parser"
version = "0.5.1"
version = "0.5.1-rev0"
authors = ["Askaholic"]
license = "LGPL-3.0"
edition = "2018"
Expand Down
2 changes: 2 additions & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ pub fn add_constants(m: &PyModule) -> PyResult<()> {
m.add(NAMES[END_GAME as usize], END_GAME)?;
m.add("MAX", MAX)?;

m.add("NAMES", NAMES)?;

Ok(())
}

Expand Down
30 changes: 30 additions & 0 deletions tests/test_constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from fafreplay import commands


def test_command_names():
assert commands.NAMES[commands.Advance] == "Advance"
assert commands.NAMES[commands.SetCommandSource] == "SetCommandSource"
assert commands.NAMES[commands.CommandSourceTerminated] == "CommandSourceTerminated"
assert commands.NAMES[commands.VerifyChecksum] == "VerifyChecksum"
assert commands.NAMES[commands.RequestPause] == "RequestPause"
assert commands.NAMES[commands.Resume] == "Resume"
assert commands.NAMES[commands.SingleStep] == "SingleStep"
assert commands.NAMES[commands.CreateUnit] == "CreateUnit"
assert commands.NAMES[commands.CreateProp] == "CreateProp"
assert commands.NAMES[commands.DestroyEntity] == "DestroyEntity"
assert commands.NAMES[commands.WarpEntity] == "WarpEntity"
assert commands.NAMES[commands.ProcessInfoPair] == "ProcessInfoPair"
assert commands.NAMES[commands.IssueCommand] == "IssueCommand"
assert commands.NAMES[commands.IssueFactoryCommand] == "IssueFactoryCommand"
assert commands.NAMES[commands.IncreaseCommandCount] == "IncreaseCommandCount"
assert commands.NAMES[commands.DecreaseCommandCount] == "DecreaseCommandCount"
assert commands.NAMES[commands.SetCommandTarget] == "SetCommandTarget"
assert commands.NAMES[commands.SetCommandType] == "SetCommandType"
assert commands.NAMES[commands.SetCommandCells] == "SetCommandCells"
assert commands.NAMES[commands.RemoveCommandFromQueue] == "RemoveCommandFromQueue"
assert commands.NAMES[commands.DebugCommand] == "DebugCommand"
assert commands.NAMES[commands.ExecuteLuaInSim] == "ExecuteLuaInSim"
assert commands.NAMES[commands.LuaSimCallback] == "LuaSimCallback"
assert commands.NAMES[commands.EndGame] == "EndGame"

assert len(commands.NAMES) == commands.MAX + 1

0 comments on commit 1963778

Please sign in to comment.