Renamed method, and added first test to cli
This commit is contained in:
@@ -1,9 +1,31 @@
|
||||
#include "ModuleDataFormatter.h"
|
||||
#include <ModuleDataFormatter.h>
|
||||
#include <GCrypt/Key.h>
|
||||
#include "Catch2.h"
|
||||
|
||||
using namespace Leonetienne::GCrypt;
|
||||
|
||||
// Empty test
|
||||
TEST_CASE(__FILE__"", "[ModuleDataFormatter]") {
|
||||
// Tests that recoding byte iobase works
|
||||
TEST_CASE(__FILE__"RecodingSingleBlock-bytes", "[ModuleDataFormatter]") {
|
||||
|
||||
// Setup
|
||||
Block b_initial;
|
||||
b_initial = Key::Random();
|
||||
|
||||
// Exercise
|
||||
// Convert to bytes
|
||||
const std::string b_format = ModuleDataFormatter::FormatBlock(
|
||||
b_initial,
|
||||
Configuration::IOBASE_FORMAT::BASE_BYTES
|
||||
);
|
||||
|
||||
// Convert back to a block
|
||||
const Block b_retrieved = ModuleDataFormatter::DecodeFormat(
|
||||
b_format,
|
||||
Configuration::IOBASE_FORMAT::BASE_BYTES
|
||||
);
|
||||
|
||||
// Verify
|
||||
// Do b_initial and b_retrieved match?
|
||||
REQUIRE(b_initial == b_retrieved);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user