Start working on build system.
This commit is contained in:
parent
4b308f6c32
commit
521486be62
88 changed files with 1065 additions and 349 deletions
18
test/core/TestFileSystemPath.cpp
Normal file
18
test/core/TestFileSystemPath.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "FileSystemPath.h"
|
||||
|
||||
#include "TestFramework.h"
|
||||
//#include "TestUtils.h"
|
||||
#include <iostream>
|
||||
|
||||
TEST_CASE(FileSystemPath_Join, "core")
|
||||
{
|
||||
FileSystemPath path("/home/jgrogan/code/compilz/src/src");
|
||||
auto new_path = path.join("test");
|
||||
REQUIRE(new_path.str() == "/home/jgrogan/code/compilz/src/src/test");
|
||||
}
|
||||
|
||||
TEST_CASE(FileSystemPath_Extension, "core")
|
||||
{
|
||||
FileSystemPath path("test.dat");
|
||||
REQUIRE(path.extension() == ".dat");
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
//#include "TestUtils.h"
|
||||
#include <iostream>
|
||||
|
||||
TEST_CASE(TestBasicStringOps, "core")
|
||||
TEST_CASE(String_Append, "core")
|
||||
{
|
||||
String str;
|
||||
str += 'a';
|
||||
|
@ -12,9 +12,10 @@ TEST_CASE(TestBasicStringOps, "core")
|
|||
str += 'c';
|
||||
str += 'd';
|
||||
REQUIRE(str == "abcd");
|
||||
String long_string("abc/def/ghi/jkl");
|
||||
}
|
||||
|
||||
TEST_CASE(TestStringReverse, "core")
|
||||
TEST_CASE(String_Reverse, "core")
|
||||
{
|
||||
String str0;
|
||||
str0.reverse();
|
||||
|
@ -37,6 +38,35 @@ TEST_CASE(TestStringReverse, "core")
|
|||
REQUIRE(str4 == "dcba");
|
||||
}
|
||||
|
||||
TEST_CASE(String_Extend, "core")
|
||||
{
|
||||
String str("/home/jgrogan/code/compilz/src/src");
|
||||
auto str_cpy = str;
|
||||
str += "/";
|
||||
str += "test";
|
||||
REQUIRE(str == String("/home/jgrogan/code/compilz/src/src/test"));
|
||||
|
||||
str_cpy += "/";
|
||||
str_cpy += "test";
|
||||
REQUIRE(str == str_cpy);
|
||||
}
|
||||
|
||||
TEST_CASE(String_Slice, "core")
|
||||
{
|
||||
String str("test.dat");
|
||||
const auto rindex = str.rindex('.');
|
||||
REQUIRE(rindex.valid());
|
||||
REQUIRE(rindex.value() == 4);
|
||||
|
||||
String right;
|
||||
str.slice(rindex.value(), str.size(), right);
|
||||
REQUIRE(right == ".dat");
|
||||
|
||||
const auto split = str.rsplit('.');
|
||||
REQUIRE(split.first() == "test");
|
||||
REQUIRE(split.second() == "dat");
|
||||
}
|
||||
|
||||
/*
|
||||
TEST_CASE(TestStringUtils_StripSurroundingWhitepsace, "core")
|
||||
{
|
||||
|
|
|
@ -4,15 +4,38 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
TEST_CASE(TestVectorOps, "core")
|
||||
TEST_CASE(TestVectorExtend, "core")
|
||||
{
|
||||
Vector<size_t> vec;
|
||||
for(size_t idx=0;idx<100;idx++)
|
||||
for(size_t idx=0; idx<16; idx++)
|
||||
{
|
||||
vec.push_back(idx);
|
||||
}
|
||||
for(size_t idx=0; idx<100; idx++)
|
||||
REQUIRE(vec.size() == 16);
|
||||
|
||||
Vector<size_t> vec0;
|
||||
for(size_t idx=16; idx<19; idx++)
|
||||
{
|
||||
REQUIRE(vec[idx] == idx);
|
||||
vec0.push_back(idx);
|
||||
}
|
||||
vec.extend(vec0);
|
||||
REQUIRE(vec.size() == 19);
|
||||
}
|
||||
|
||||
TEST_CASE(TestVectorSlize, "core")
|
||||
{
|
||||
Vector<size_t> vec;
|
||||
for(size_t idx=0; idx<8; idx++)
|
||||
{
|
||||
vec.push_back(idx);
|
||||
}
|
||||
|
||||
Vector<size_t> bottom_half;
|
||||
vec.slice(4, bottom_half);
|
||||
REQUIRE(bottom_half.size() == 4);
|
||||
|
||||
Vector<size_t> top_half;
|
||||
vec.slice(4, 8, top_half);
|
||||
REQUIRE(top_half.size() == 4);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue