summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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