summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ctor.cc12
-rw-r--r--test/source_type_test.cc31
-rw-r--r--test/tasks_test.cc2
-rw-r--r--test/tools_test.cc4
4 files changed, 29 insertions, 20 deletions
diff --git a/test/ctor.cc b/test/ctor.cc
index 89a94b9..1a63486 100644
--- a/test/ctor.cc
+++ b/test/ctor.cc
@@ -5,12 +5,12 @@
namespace
{
-BuildConfigurations ctorTestConfigs(const Settings& settings)
+ctor::BuildConfigurations ctorTestConfigs(const ctor::Settings& settings)
{
return
{
{
- .type = TargetType::UnitTest,
+ .type = ctor::TargetType::UnitTest,
.target = "execute_test",
.sources = {
"execute_test.cc",
@@ -27,7 +27,7 @@ BuildConfigurations ctorTestConfigs(const Settings& settings)
},
},
{
- .type = TargetType::UnitTest,
+ .type = ctor::TargetType::UnitTest,
.target = "tasks_test",
.sources = {
"tasks_test.cc",
@@ -44,7 +44,7 @@ BuildConfigurations ctorTestConfigs(const Settings& settings)
},
},
{
- .type = TargetType::UnitTest,
+ .type = ctor::TargetType::UnitTest,
.target = "source_type_test",
.sources = {
"source_type_test.cc",
@@ -61,7 +61,7 @@ BuildConfigurations ctorTestConfigs(const Settings& settings)
},
},
{
- .type = TargetType::UnitTest,
+ .type = ctor::TargetType::UnitTest,
.target = "tools_test",
.sources = {
"tools_test.cc",
@@ -78,7 +78,7 @@ BuildConfigurations ctorTestConfigs(const Settings& settings)
},
},
{
- .type = TargetType::UnitTestLib,
+ .type = ctor::TargetType::UnitTestLib,
.target = "libctor_nomain.a",
.sources = {
"../src/build.cc",
diff --git a/test/source_type_test.cc b/test/source_type_test.cc
index ce1923e..e64aaee 100644
--- a/test/source_type_test.cc
+++ b/test/source_type_test.cc
@@ -1,37 +1,40 @@
-#include <uunit.h>
-
#include <ctor.h>
#include <task_cc.h>
-std::ostream& operator<<(std::ostream& stream, const Language& lang)
+std::ostream& operator<<(std::ostream& stream, const ctor::Language& lang);
+
+#include <uunit.h>
+
+std::ostream& operator<<(std::ostream& stream, const ctor::Language& lang)
{
switch(lang)
{
- case Language::Auto:
+ case ctor::Language::Auto:
stream << "Language::Auto";
break;
- case Language::C:
+ case ctor::Language::C:
stream << "Language::C";
break;
- case Language::Cpp:
+ case ctor::Language::Cpp:
stream << "Language::Cpp";
break;
- case Language::Asm:
+ case ctor::Language::Asm:
stream << "Language::Asm";
break;
}
return stream;
}
+
class TestableTaskCC
: public TaskCC
{
public:
- TestableTaskCC(const Source& source)
+ TestableTaskCC(const ctor::Source& source)
: TaskCC({}, {}, "build", source)
{}
- Language language() const
+ ctor::Language language() const
{
return source_language;
}
@@ -50,22 +53,22 @@ public:
{
{ // c++
TestableTaskCC task("hello.cc");
- uASSERT_EQUAL(Language::Cpp, task.language());
+ uASSERT_EQUAL(ctor::Language::Cpp, task.language());
}
{ // c
TestableTaskCC task("hello.c");
- uASSERT_EQUAL(Language::C, task.language());
+ uASSERT_EQUAL(ctor::Language::C, task.language());
}
{ // asm
TestableTaskCC task("hello.s");
- uASSERT_EQUAL(Language::Asm, task.language());
+ uASSERT_EQUAL(ctor::Language::Asm, task.language());
}
{ // custom/explicit language
- TestableTaskCC task( {"hello.foo", Language::Asm} );
- uASSERT_EQUAL(Language::Asm, task.language());
+ TestableTaskCC task( {"hello.foo", ctor::Language::Asm} );
+ uASSERT_EQUAL(ctor::Language::Asm, task.language());
}
// Note: Failure state will result in exit(1) so cannot be tested
diff --git a/test/tasks_test.cc b/test/tasks_test.cc
index a660994..594261d 100644
--- a/test/tasks_test.cc
+++ b/test/tasks_test.cc
@@ -3,6 +3,8 @@
#include <ctor.h>
#include <tasks.h>
+using namespace ctor;
+
namespace
{
BuildConfigurations ctorTestConfigs1(const Settings&)
diff --git a/test/tools_test.cc b/test/tools_test.cc
index 743edb6..0f97bd3 100644
--- a/test/tools_test.cc
+++ b/test/tools_test.cc
@@ -11,6 +11,7 @@ std::ostream& operator<<(std::ostream& stream, const std::vector<std::string>& v
#include <tools.h>
+using namespace ctor;
using namespace std::string_literals;
std::ostream& operator<<(std::ostream& stream, const ToolChain& tool_chain)
@@ -85,6 +86,8 @@ namespace
std::string conf_host_cxx{};
std::string conf_build_cxx{};
}
+
+namespace ctor {
const std::string& getConfiguration(const std::string& key,
const std::string& defval)
{
@@ -103,6 +106,7 @@ const std::string& getConfiguration(const std::string& key,
static std::string res{};
return res;
}
+} // namespace ctor::
class ToolsTest
: public uUnit