summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustyna Ilczuk <justyna.ilczuk@gmail.com>2013-01-13 13:53:17 +0100
committerJustyna Ilczuk <justyna.ilczuk@gmail.com>2013-01-13 13:53:17 +0100
commit837d4c4bce813919f6713f76c7c24404951751f6 (patch)
tree738e3d1d36083258d211217641ddbbe58f31b8c0
parent53f8ba2097355f7f488ed04b1d86d037e47216f2 (diff)
downloadsencha-lang-837d4c4bce813919f6713f76c7c24404951751f6.tar.gz
sencha-lang-837d4c4bce813919f6713f76c7c24404951751f6.tar.bz2
sencha-lang-837d4c4bce813919f6713f76c7c24404951751f6.zip
Some informative comments.
-rw-r--r--Sencha-lang/Tests/TestSuite.cpp8
-rw-r--r--Sencha-lang/Tests/TestSuite.h16
-rw-r--r--Sencha-lang/Tests/how_to_run_tests40
3 files changed, 55 insertions, 9 deletions
diff --git a/Sencha-lang/Tests/TestSuite.cpp b/Sencha-lang/Tests/TestSuite.cpp
index f50531c..a23181d 100644
--- a/Sencha-lang/Tests/TestSuite.cpp
+++ b/Sencha-lang/Tests/TestSuite.cpp
@@ -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;
}
diff --git a/Sencha-lang/Tests/TestSuite.h b/Sencha-lang/Tests/TestSuite.h
index c532443..0b8c16c 100644
--- a/Sencha-lang/Tests/TestSuite.h
+++ b/Sencha-lang/Tests/TestSuite.h
@@ -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();
diff --git a/Sencha-lang/Tests/how_to_run_tests b/Sencha-lang/Tests/how_to_run_tests
new file mode 100644
index 0000000..91f27c2
--- /dev/null
+++ b/Sencha-lang/Tests/how_to_run_tests
@@ -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
+""" \ No newline at end of file