Handling a lot of boiling plating using m4 and bash so we don't get carpal tunnel from writing tons of repetitive Java.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

template_for_test_class.txt 914B

12345678910111213141516171819202122232425262728293031
  1. // EXPC means expected.
  2. public static class Test<name>{
  3. public static void test(){
  4. <name> testInstance = new <name>(<params>);
  5. <data type> expectedValue<data member name> = EXPC;
  6. ...
  7. testInstance.set<data member>(EXPC);
  8. expectedValue<data member name> = EXPC;
  9. if(testInstance.get<data member>() != expectedValue<data member> ||
  10. testInstance.get<next data member> != expectedValue<data member> ||
  11. ...){
  12. throw new Exception("<name> unexpectedly changed!");
  13. }
  14. ...
  15. if(testInstance.<method name>(<params>) != EXPC) {
  16. throw new Exception("<method name> in <name> gave unexpected results!");
  17. }
  18. expectedValue<data member name> = EXPC;
  19. ...
  20. if(testInstance.get<data member>() != expectedValue<data member> ||
  21. testInstance.get<next data member> != expectedValue<data member> ||
  22. ...){
  23. throw new Exception("<name> unexpectedly changed in <method name>!");
  24. }
  25. ...
  26. }
  27. }