horcrux/test/test.h

48 lines
1.6 KiB
C++

#ifndef HORCRUX_TEST_TEST_H
#define HORCRUX_TEST_TEST_H
#include <filesystem>
#include <algorithm>
#include "io.h"
#include "crypto.h"
#include "utils.h"
/* IO Test utils */
#ifndef TEST_WORK_DIR
#error Please define TEST_WORK_DIR
#endif
const std::string folder{TEST_WORK_DIR};
const std::string noexist{TEST_WORK_DIR "/nope"};
const std::string empty{TEST_WORK_DIR "/empty"};
const std::string text{TEST_WORK_DIR "/test.txt"};
const std::string image{TEST_WORK_DIR "/mangoni.jpg"};
horcrux::raw_data generic_read_file(const std::string& filename);
std::vector<std::string> get_created_filenames(const horcrux::FsCryptoOutput& out);
void delete_created_files(const horcrux::FsCryptoOutput& out);
std::vector<std::string> get_encrypted_files(const std::string& folder, const std::string& basename);
/* Crypto Test utils */
/* test command:
echo "ditemi perche' se la mucca fa mu il merlo non fa me" |
scripts/aes256.sh -k 0123456789ABCDEF0123456789ABCDEF -i 0123456789ABCDEF |
xxd -i
*/
const std::string test1_str = "ditemi perche' se la mucca fa mu il merlo non fa me";
const std::string test1_key = "0123456789ABCDEF0123456789ABCDEF";
const std::string test1_iv = "0123456789ABCDEF";
const horcrux::raw_data test1_enc {
0x4c, 0x17, 0x6e, 0x6d, 0xd2, 0x83, 0x51, 0x52, 0xfc, 0x5d, 0xbe, 0x0f,
0x1b, 0xcf, 0x86, 0xef, 0x73, 0x91, 0x58, 0xc4, 0xdd, 0x1b, 0x09, 0x3d,
0x77, 0xe0, 0x78, 0x5d, 0x21, 0xfe, 0x59, 0x9c, 0xb2, 0x12, 0xa6, 0x81,
0x12, 0x96, 0x50, 0xd6, 0x5c, 0xe2, 0xc1, 0x99, 0xe3, 0x38, 0x39, 0x8e,
0x55, 0xd2, 0x04, 0x73, 0x16, 0x39, 0xc7, 0x6a, 0xd3, 0x61, 0x2c, 0x22,
0x59, 0x25, 0xa6, 0x20 };
#endif //HORCRUX_TEST_TEST_H