Add test fixture.

This commit is contained in:
James Grogan 2022-11-29 18:00:19 +00:00
parent af6fad72eb
commit d6d4319e21
37 changed files with 421 additions and 279 deletions

View file

@ -1,4 +0,0 @@
int main()
{
return 0;
}

View file

@ -1,9 +1,11 @@
#include "ByteUtils.h"
#include "BufferBitStream.h"
#include "TestFramework.h"
#include <iostream>
void testReading()
TEST_CASE(TestReadBitStream, "core")
{
std::vector<std::string> bytes{
"11101101",
@ -37,7 +39,7 @@ void testReading()
std::cout << "Slice3 is " << ByteUtils::toString(buffer) << std::endl;
}
void testWriting()
TEST_CASE(TestWritingBitStream, "core")
{
BufferBitStream stream;
@ -72,13 +74,3 @@ void testWriting()
std::cout << "Got bytes 3 " << byte3 << std::endl;
std::cout << "Got bytes 4 " << byte4 << std::endl;
}
int main()
{
//testReading()
testWriting();
return 0;
}

View file

@ -1,8 +1,10 @@
#include "ByteUtils.h"
#include "TestFramework.h"
#include <iostream>
int main()
TEST_CASE(TestReadByteUtils, "core")
{
auto byte = ByteUtils::getFromString("00110101");
std::cout << "Value is " << static_cast<unsigned>(byte) << std::endl;
@ -32,6 +34,4 @@ int main()
unsigned hold = byte;
hold = (hold << 5) + 3;
std::cout << "Big val is " << ByteUtils::toString(hold, 16) << std::endl;
return 0;
}

View file

@ -1,8 +1,10 @@
#include "CircleBuffer.h"
#include "TestFramework.h"
#include <iostream>
int main()
TEST_CASE(TestCircleBuffer, "core")
{
CircleBuffer<unsigned> buffer(3);
@ -29,6 +31,4 @@ int main()
auto item = buffer.getItem(idx);
std::cout << "Got item: " << idx << " " << item << std::endl;
}
return 0;
}

View file

@ -1,9 +1,11 @@
#include "TomlReader.h"
#include "TestFramework.h"
#include <filesystem>
#include <iostream>
int main()
TEST_CASE(TestTomlReader, "core")
{
const auto data_loc = std::filesystem::path(__FILE__) / "../../data";
const auto sample_toml_file = data_loc / "sample_toml.toml";
@ -16,6 +18,4 @@ int main()
{
std::cout << "Got entry with key: " << items.first << " and val " << items.second << std::endl;
}
return 0;
}