|
| 1 | +/* |
| 2 | + Copyright (c) 2012 Torbjörn Klatt <[email protected]> |
| 3 | +
|
| 4 | + Permission is hereby granted, free of charge, to any person |
| 5 | + obtaining a copy of this software and associated documentation |
| 6 | + files (the "Software"), to deal in the Software without |
| 7 | + restriction, including without limitation the rights to use, |
| 8 | + copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 | + copies of the Software, and to permit persons to whom the |
| 10 | + Software is furnished to do so, subject to the following |
| 11 | + conditions: |
| 12 | +
|
| 13 | + The above copyright notice and this permission notice shall be |
| 14 | + included in all copies or substantial portions of the Software. |
| 15 | +
|
| 16 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 17 | + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
| 18 | + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 19 | + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 20 | + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 21 | + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 22 | + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 23 | + OTHER DEALINGS IN THE SOFTWARE. |
| 24 | +*/ |
| 25 | + |
| 26 | +#include "../helper.hpp" |
| 27 | + |
| 28 | +// Do not to forget to rename the preprocessor directives as well! |
| 29 | +#ifndef KOANXX_SAMPLE_KOANS_HPP |
| 30 | +#define KOANXX_SAMPLE_KOANS_HPP |
| 31 | + |
| 32 | +// Rename the Episode |
| 33 | +class KoanXX_sample_koans : Koan |
| 34 | +{ |
| 35 | + private: |
| 36 | + KoanHandler *status; //! |
| 37 | + // When ever a koan is added at the very bottom, this counter needs to be |
| 38 | + // increased. |
| 39 | + static const int num_tests = 1; //! |
| 40 | + |
| 41 | + public: |
| 42 | + /** |
| 43 | + * |
| 44 | + */ |
| 45 | + KoanXX_sample_koans( KoanHandler *status ) : status( status ) { |
| 46 | + status->register_koans( num_tests ); |
| 47 | + } |
| 48 | + /** |
| 49 | + * |
| 50 | + */ |
| 51 | + ~KoanXX_sample_koans() {} |
| 52 | + |
| 53 | + /** |
| 54 | + * |
| 55 | + */ |
| 56 | + void run() { |
| 57 | + // For each koan in this episode, one line needs to be written. |
| 58 | + // The koans are executed in the order they are called here. |
| 59 | + status->eval_koan( *this, static_cast<void ( Koan:: * )()>( &KoanXX_sample_koans::a_sample_koan ) ); |
| 60 | + |
| 61 | + status->episode_done( "the-so-and-so'th" ); |
| 62 | + } |
| 63 | + |
| 64 | + /** |
| 65 | + * |
| 66 | + */ |
| 67 | + static int get_num_tests() { |
| 68 | + return num_tests; |
| 69 | + } |
| 70 | + |
| 71 | + private: |
| 72 | + // Add further Koans down here by defining their name. |
| 73 | + // The implementation of these is done in ~/koans/koanXX_sample_koans.cpp |
| 74 | + // REMARK: Do not forget to increase this.num_tests when you add another koan |
| 75 | + void a_sample_koan(); |
| 76 | +}; |
| 77 | + |
| 78 | +#endif // KOAN04_ARRAYS_HPP |
| 79 | + |
| 80 | +// EOF |
0 commit comments