Skip to content

Commit

Permalink
Add more Algorithm tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phitsc committed Jan 13, 2016
1 parent 8cd3e6f commit fa2e31a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/txtproc/Algorithm.d
Expand Up @@ -143,3 +143,29 @@ private:
immutable ParameterDescriptions m_parameterDescriptions;
immutable Process m_process;
}

unittest
{
import std.exception;

auto a = new Algorithm("Name", "Group", "Description of Name", [
ParameterDescription("Parameter One"),
ParameterDescription("Parameter One", Default("Default value")),
],
(string text, string[] params, bool ignoreCase) {
return text ~ params[0];
}
);

assert(a.name == "Name");
assert(a.group == "Group");
assert(a.description == "Description of Name");
assert(a.process("Input text ", [ "Param" ], false) == "Input text Param");
assert(a.parameterDescriptions[0].description == "Parameter One");

assert(a == a);
auto b = a;
assert(b == a);

assertThrown(a.process("Input text", [], false));
}

0 comments on commit fa2e31a

Please sign in to comment.