-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathcompilation.cpp
More file actions
51 lines (45 loc) · 1.43 KB
/
Copy pathcompilation.cpp
File metadata and controls
51 lines (45 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "../Builder.h"
#include "../FileUtil.h"
#include "../thirdparty/catch.hpp"
using namespace FileUtil;
using namespace std;
const string fetish_dir = "../fetishes/";
const auto fetishes = getDirectoriesInDirectory(fetish_dir);
const string out = "./output_from_unit_tests.exe";
// Run the unit.fet file in every fetish
void runFetishUnitTests(Builder& bob) {
for (const string& fetish : fetishes) {
REQUIRE_NOTHROW(bob.setSource(fetish_dir + fetish + "/unit.fet"));
REQUIRE_NOTHROW(bob.setDestination(out));
REQUIRE_NOTHROW(bob.build());
if (system(out.c_str())) {
CAPTURE(fetish);
FAIL("Compiled fetish unit test returned error");
}
}
}
TEST_CASE("Build and compile Fetish unit tests", "[Builder][Integration]") {
ensureFileDoesNotExist(out);
Builder bob;
REQUIRE_NOTHROW(bob.clean());
SECTION("Build and compile unoptimized Fetish unit tests") {
bob.setLinkTimeOptimization(false);
bob.setOptimization(false);
runFetishUnitTests(bob);
}
SECTION("Build and compile link time optimized Fetish unit tests") {
bob.setLinkTimeOptimization(true);
bob.setOptimization(false);
runFetishUnitTests(bob);
}
SECTION("Build and compile fully optimized Fetish unit tests") {
bob.setLinkTimeOptimization(true);
bob.setOptimization(true);
runFetishUnitTests(bob);
}
SECTION("Build and compile optimized Fetish unit tests") {
bob.setLinkTimeOptimization(false);
bob.setOptimization(true);
runFetishUnitTests(bob);
}
}