Browse Source

Template for test class

master
Cameron Weinfurt 3 years ago
parent
commit
f4f4ecf176
  1. 31
      template_for_test_class.txt

31
template_for_test_class.txt

@ -0,0 +1,31 @@
// EXPC means expected.
public static class Test<name>{
public static void test(){
<name> testInstance = new <name>(<params>);
<data type> expectedValue<data member name> = EXPC;
...
testInstance.set<data member>(EXPC);
expectedValue<data member name> = EXPC;
if(testInstance.get<data member>() != expectedValue<data member> ||
testInstance.get<next data member> != expectedValue<data member> ||
...){
throw new Exception("<name> unexpectedly changed!");
}
...
if(testInstance.<method name>(<params>) != EXPC) {
throw new Exception("<method name> in <name> gave unexpected results!");
}
expectedValue<data member name> = EXPC;
...
if(testInstance.get<data member>() != expectedValue<data member> ||
testInstance.get<next data member> != expectedValue<data member> ||
...){
throw new Exception("<name> unexpectedly changed in <method name>!");
}
...
}
}
Loading…
Cancel
Save