code_junkie

Implementing xunit in a new programming language

Nov 11th, 2011
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. void Main()
  2. {
  3. var algorithmToTest = MyUniversalQuestionSolver();
  4. var question = Answer to { Life, Universe && Everything };
  5.  
  6. var actual = algorithmToTest(question);
  7. var expected = 42;
  8. if (actual != expected) Error();
  9.  
  10. // ... add a bunch of tests
  11. }
  12.  
  13. MAIN.
  14. COMPUTE EXPECTED_ANSWER = 42
  15. SOLVE ANSWER_TO_EVERYTHING GIVING ACTUAL_ANSWER
  16. SUBTRACT ACTUAL_ANSWER FROM EXPECTED_ANSWER GIVING DIFFERENCE
  17. IF DIFFERENCE NOT.EQ 0 THEN
  18. DISPLAY "ERROR!"
  19. END-IF
  20.  
  21. * ... add a bunch of tests
  22. STOP RUN
Add Comment
Please, Sign In to add comment