Some informative comments.

master
Justyna Ilczuk 2013-01-13 13:53:17 +01:00
parent 53f8ba2097
commit 837d4c4bce
3 changed files with 55 additions and 9 deletions

View File

@ -12,18 +12,12 @@ TestSuite::TestSuite() {
tests_passed = 0;
tests_failed = 0;
tests = 0;
}
TestSuite::~TestSuite() {
//Do nothing
}
std::string TestSuite::all_tests()
{
return "";
}
void TestSuite::run_tests()
{
@ -40,5 +34,5 @@ void TestSuite::run_tests()
}
std::cout << tests_passed << " TESTS PASSED\n";
std::cout << tests_failed << " TESTS FAILED\n";
std::cout << "ALL TESTS: " << tests << std::endl;
std::cout << "ALL TESTS: " << tests << std::endl << std::endl;
}

View File

@ -11,15 +11,27 @@
#include "minunit.h"
#include <iostream>
/**
* TestSuite is main part of test framework. It is a base class for all other
* test suites such as TestParser suite and so on.
*
*/
class TestSuite {
public:
int tests_passed;
int tests_failed;
int tests;
/**
* run_tests() is crucial method. It's really universal and very useful.
* It runs tests and gathers all data acquired during running tests and display them.
*/
void run_tests();
virtual std::string all_tests();
/**
* all_tests() is a virtual method which is used in run_tests() function. It has to be overloaded in
* classes which inherits TestSuite.
*/
virtual std::string all_tests() = 0;
TestSuite();
virtual ~TestSuite();

View File

@ -0,0 +1,40 @@
It's simple.
Go to the terminal.
Find SenchaLang exectuive file. Run it with --test.
When I just did it, I got such output:
"""
I'm running tests
Testing lexer...
ALL TESTS PASSED
5 TESTS PASSED
0 TESTS FAILED
ALL TESTS: 5
Testing ASTInspector...
ALL TESTS PASSED
2 TESTS PASSED
0 TESTS FAILED
ALL TESTS: 2
Testing parser...
ALL TESTS PASSED
4 TESTS PASSED
0 TESTS FAILED
ALL TESTS: 4
Testing standard library...
SOME TESTS DIDN'T PASS
in test_string_lib: Write this test
0 TESTS PASSED
1 TESTS FAILED
ALL TESTS: 1
"""