|
| 1 | + |
| 2 | +! This test was created from ..\..\exercism\problem-specifications\exercises\bob\canonical-data.json |
| 3 | +! version: 1.4.0. |
| 4 | +! |
| 5 | +! This is the main test program to test your implementaion which is done in |
| 6 | +! bob.f90 |
| 7 | +! |
| 8 | +! If the file does not exist create it. |
| 9 | +! |
| 10 | +! To build your program first create a build directory, eg. Debug and change into it |
| 11 | +! > mkdir Debug |
| 12 | +! > cd Debug |
| 13 | +! Now, to configure the build you run |
| 14 | +! > cmake .. |
| 15 | +! Which creates the build files (Makefiles etc.) needed to build and test your program. |
| 16 | +! Now build your program with |
| 17 | +! > make |
| 18 | +! If your build is successfull run the test |
| 19 | +! > ctest -V |
| 20 | +! If the build fails or the tests, modify the implementation in hello_world.f90 and rerun |
| 21 | +! the "make" and the "ctest -V" commands. |
| 22 | +! |
| 23 | +! Now proceed to the test section and one test after the other, ensure your implementation |
| 24 | +! passes this test. |
| 25 | + |
| 26 | + |
| 27 | +program bob_test_main |
| 28 | + use TesterMain |
| 29 | + use bob |
| 30 | + implicit none |
| 31 | + |
| 32 | + |
| 33 | + ! Test 1: stating something |
| 34 | + call assert_equal("Whatever.", hey("Tom-ay-to, tom-aaaah-to."), "stating something") |
| 35 | + ! Test 2: shouting |
| 36 | + call assert_equal("Whoa, chill out!", hey("WATCH OUT!"), "shouting") |
| 37 | + ! Test 3: shouting gibberish |
| 38 | + call assert_equal("Whoa, chill out!", hey("FCECDFCAAB"), "shouting gibberish") |
| 39 | + ! Test 4: asking a question |
| 40 | + call assert_equal("Sure.", hey("Does this cryogenic chamber make me look fat?"), "asking a question") |
| 41 | + ! Test 5: asking a numeric question |
| 42 | + call assert_equal("Sure.", hey("You are, what, like 15?"), "asking a numeric question") |
| 43 | + ! Test 6: asking gibberish |
| 44 | + call assert_equal("Sure.", hey("fffbbcbeab?"), "asking gibberish") |
| 45 | + ! Test 7: talking forcefully |
| 46 | + call assert_equal("Whatever.", hey("Let's go make out behind the gym!"), "talking forcefully") |
| 47 | + ! Test 8: using acronyms in regular speech |
| 48 | + call assert_equal("Whatever.", hey("It's OK if you don't want to go to the DMV."), "using acronyms in regular speech") |
| 49 | + ! Test 9: forceful question |
| 50 | + call assert_equal("Calm down, I know what I'm doing!", hey("WHAT THE HELL WERE YOU THINKING?"), "forceful question") |
| 51 | + ! Test 10: shouting numbers |
| 52 | + call assert_equal("Whoa, chill out!", hey("1, 2, 3 GO!"), "shouting numbers") |
| 53 | + ! Test 11: no letters |
| 54 | + call assert_equal("Whatever.", hey("1, 2, 3"), "no letters") |
| 55 | + ! Test 12: question with no letters |
| 56 | + call assert_equal("Sure.", hey("4?"), "question with no letters") |
| 57 | + ! Test 13: shouting with special characters |
| 58 | + call assert_equal("Whoa, chill out!", hey("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"), "shouting with special characters") |
| 59 | + ! Test 14: shouting with no exclamation mark |
| 60 | + call assert_equal("Whoa, chill out!", hey("I HATE THE DMV"), "shouting with no exclamation mark") |
| 61 | + ! Test 15: statement containing question mark |
| 62 | + call assert_equal("Whatever.", hey("Ending with ? means a question."), "statement containing question mark") |
| 63 | + ! Test 16: non-letters with question |
| 64 | + call assert_equal("Sure.", hey(":) ?"), "non-letters with question") |
| 65 | + ! Test 17: prattling on |
| 66 | + call assert_equal("Sure.", hey("Wait! Hang on. Are you going to be OK?"), "prattling on") |
| 67 | + ! Test 18: silence |
| 68 | + call assert_equal("Fine. Be that way!", hey(""), "silence") |
| 69 | + ! Test 19: prolonged silence |
| 70 | + call assert_equal("Fine. Be that way!", hey(" "), "prolonged silence") |
| 71 | + ! Test 20: alternate silence |
| 72 | + !call assert_equal("Fine. Be that way!", hey(" "), "alternate silence") |
| 73 | + ! Test 21: multiple line question |
| 74 | + call assert_equal("Whatever.", hey(""// & |
| 75 | + & "Does this cryogenic chamber make me look fat?"// & |
| 76 | + & "No."), "multiple line question") |
| 77 | + ! Test 22: starting with whitespace |
| 78 | + call assert_equal("Whatever.", hey(" hmmmmmmm..."), "starting with whitespace") |
| 79 | + ! Test 23: ending with whitespace |
| 80 | + call assert_equal("Sure.", hey("Okay if like my spacebar quite a bit? "), "ending with whitespace") |
| 81 | + ! Test 24: other whitespace |
| 82 | + !call assert_equal("Fine. Be that way!", hey(""// & |
| 83 | + ! & " |
| 84 | + ! "), "other whitespace") |
| 85 | + ! Test 25: non-question ending with whitespace |
| 86 | + call assert_equal("Whatever.", hey("This is a statement ending with whitespace "), "non-question ending with whitespace") |
| 87 | + |
| 88 | + call test_report() |
| 89 | + |
| 90 | +end program |
| 91 | + |
0 commit comments