Updated tests, changed model encoders to output content to a stream
This commit is contained in:
@@ -19,8 +19,9 @@ using namespace OpenVulkano;
|
||||
TEST_CASE("Empty zip file", "[ZipWriter]")
|
||||
{
|
||||
const auto emptyZipPath = AppFolders::GetAppTempDir() / "empty.zip";
|
||||
ZipWriter writer(emptyZipPath);
|
||||
writer.Close();
|
||||
{
|
||||
ZipWriter writer(emptyZipPath);
|
||||
}
|
||||
auto mem = Utils::ReadFile(emptyZipPath);
|
||||
const int expectSize = 22;
|
||||
Array<uint8_t> expect = {0x50, 0x4b, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
@@ -34,15 +35,17 @@ TEST_CASE("Empty zip file", "[ZipWriter]")
|
||||
TEST_CASE("Zip with one file(AAA.txt that has 'AAA')", "[ZipWriter]")
|
||||
{
|
||||
const auto oneFileZipPath = AppFolders::GetAppTempDir() / "one_file.zip";
|
||||
ZipWriter writer(oneFileZipPath);
|
||||
|
||||
{
|
||||
ZipWriter writer(oneFileZipPath);
|
||||
|
||||
FileDescription desc = FileDescription::MakeDescriptionForFile("AAA.txt", 3);
|
||||
desc.modTime = {};
|
||||
desc.createTime = {};
|
||||
char buffer[] = {'A', 'A', 'A'};
|
||||
FileDescription desc = FileDescription::MakeDescriptionForFile("AAA.txt", 3);
|
||||
desc.modTime = {};
|
||||
desc.createTime = {};
|
||||
char buffer[] = {'A', 'A', 'A'};
|
||||
|
||||
writer.AddFile(desc, buffer);
|
||||
writer.Close();
|
||||
writer.AddFile(desc, buffer);
|
||||
}
|
||||
|
||||
auto mem = Utils::ReadFile(oneFileZipPath);
|
||||
|
||||
@@ -67,21 +70,22 @@ TEST_CASE("Zip with one file(AAA.txt that has 'AAA')", "[ZipWriter]")
|
||||
TEST_CASE("Zip with two files(AAA.txt that has 'AAA', BBB.bin that has 'BBB')", "[ZipWriter]")
|
||||
{
|
||||
const auto twoFilesZipPath = AppFolders::GetAppTempDir() / "two_files.zip";
|
||||
ZipWriter writer(twoFilesZipPath);
|
||||
{
|
||||
ZipWriter writer(twoFilesZipPath);
|
||||
|
||||
FileDescription aaa = FileDescription::MakeDescriptionForFile("AAA.txt", 3);
|
||||
aaa.modTime = {};
|
||||
aaa.createTime = {};
|
||||
char aaaBuffer[] = {'A', 'A', 'A'};
|
||||
FileDescription aaa = FileDescription::MakeDescriptionForFile("AAA.txt", 3);
|
||||
aaa.modTime = {};
|
||||
aaa.createTime = {};
|
||||
char aaaBuffer[] = {'A', 'A', 'A'};
|
||||
|
||||
FileDescription bbb = FileDescription::MakeDescriptionForFile("BBB.bin", 3);
|
||||
bbb.modTime = {};
|
||||
bbb.createTime = {};
|
||||
char bbbBuffer[] = {'B', 'B', 'B'};
|
||||
FileDescription bbb = FileDescription::MakeDescriptionForFile("BBB.bin", 3);
|
||||
bbb.modTime = {};
|
||||
bbb.createTime = {};
|
||||
char bbbBuffer[] = {'B', 'B', 'B'};
|
||||
|
||||
writer.AddFile(aaa, aaaBuffer);
|
||||
writer.AddFile(bbb, bbbBuffer);
|
||||
writer.Close();
|
||||
writer.AddFile(aaa, aaaBuffer);
|
||||
writer.AddFile(bbb, bbbBuffer);
|
||||
}
|
||||
|
||||
auto mem = Utils::ReadFile(twoFilesZipPath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user