test/src/SuiteMaker.cc
author Krista Bennett <krista@pep-project.org>
Thu, 03 May 2018 12:39:56 +0200
branchlocal_cpptest
changeset 2645 a1932fb654b8
parent 2644 271d7a25c8d3
child 2650 cafe06d8b209
permissions -rw-r--r--
Fixed generation
krista@2645
     1
// This file is under GNU General Public License 3.0
krista@2645
     2
// see LICENSE.txt
krista@2645
     3
krista@2645
     4
//
krista@2645
     5
// src/SuiteMaker.cc generated by gensuitemaker.py - changes may be overwritten. You've been warned!
krista@2645
     6
//
krista@2645
     7
krista@2637
     8
#include <cpptest.h>
krista@2634
     9
#include <cpptest-suite.h>
krista@2644
    10
#include <memory>
krista@2644
    11
#include <vector>
krista@2645
    12
#include "SuiteMaker.h"
krista@2644
    13
krista@2645
    14
// Begin where we generate stuff
krista@2634
    15
#include "DecorateTests.h"
krista@2642
    16
#include "AppleMailTests.h"
krista@2642
    17
krista@2637
    18
krista@2644
    19
const char* SuiteMaker::all_suites[] = {
krista@2642
    20
    "DecorateTests",
krista@2645
    21
    "AppleMailTests",
krista@2642
    22
};
krista@2642
    23
krista@2644
    24
// This file is generated, so magic constants are ok.
krista@2644
    25
int SuiteMaker::num_suites = 2;
krista@2644
    26
krista@2644
    27
void SuiteMaker::suitemaker_build(const char* test_class_name, const char* test_home, Test::Suite** test_suite) {
krista@2634
    28
    if (strcmp(test_class_name, "DecorateTests") == 0)
krista@2644
    29
        *test_suite = new DecorateTests(test_class_name, test_home);
krista@2641
    30
    else if (strcmp(test_class_name, "AppleMailTests") == 0)
krista@2645
    31
        *test_suite = new AppleMailTests(test_class_name, test_home);
krista@2634
    32
}
krista@2644
    33
krista@2644
    34
void SuiteMaker::suitemaker_buildlist(const char** test_class_names, int num_to_run, const char* test_home, std::vector<Test::Suite*>& test_suites) {
krista@2644
    35
    for (int i = 0; i < num_to_run; i++) {
krista@2644
    36
        Test::Suite* suite = NULL;
krista@2644
    37
        SuiteMaker::suitemaker_build(test_class_names[i], test_home, &suite);
krista@2644
    38
        if (!suite)
krista@2644
    39
            throw std::runtime_error("Could not create a test suite instance."); // FIXME, better error, cleanup, obviously
krista@2644
    40
        test_suites.push_back(suite);
krista@2645
    41
    }
krista@2644
    42
}
krista@2644
    43
void SuiteMaker::suitemaker_buildall(const char* test_home, std::vector<Test::Suite*>& test_suites) {
krista@2644
    44
    SuiteMaker::suitemaker_buildlist(SuiteMaker::all_suites, SuiteMaker::num_suites, test_home, test_suites);
krista@2644
    45
}
krista@2645
    46