|
- //////////////////////////////////////////////////////////////////////
- // Test Jig
- // Written by Jonathan A. Foster <ChipMaster@YeOlPiShack.net>
- // Started June 28th, 2021
- // Copyright 2021 JF Possibilities, Inc. All Rights Reserved
- // Included by permission from JF Possibilities, Inc.
- //
- // Simple framework for running tests and reporting. Mostly this is an
- // output formatter but also tracks stats on the tests reported to it.
- //////////////////////////////////////////////////////////////////////
- #include <string>
- #include <vector>
-
-
-
- //////////////////////////////////////////////////////////////////////
- // Pretty basic mechanism of formatting test output and performing
- // pass / fail accounting.
- //////////////////////////////////////////////////////////////////////
-
- struct TestIt {
- int count; // total count of calls to test()
- int passes; // total test() calls that matched
- std::vector<std::string> fails; // list of test titles that failed
-
- TestIt(): count(0), passes(0) {};
- void module(const std::string &title);// Start a new test module
- bool test(const std::string &title, int result, int match); // Record test result
- int report(); // Print summary report and return: 0 passed, 2 some failed, 3 compete fail, suitable for return from main()
- };
-
-
-
- //////////////////////////////////////////////////////////////////////
- // VT100 terminal control code constants
- //
- // Probably should learn to use termcap / curses.
- //
- // COLORS!
- //////////////////////////////////////////////////////////////////////
- namespace vt100 {
-
- const std::string
- RED = "\e[31;1m",
- YLW = "\e[33;1m",
- GRN = "\e[32m",
- GRY = "\e[2m",
- CYN = "\e[36m",
- RST = "\e[0m";
-
- }
|