awtk/tests/zip_file_test.cc
2024-03-04 08:36:47 +08:00

19 lines
598 B
C++

#include <string>
#include "tkc/fs.h"
#include "tkc/utils.h"
#include "gtest/gtest.h"
#include "tkc/zip_file.h"
TEST(ZipFile, basic) {
const char* dst = "temp";
const char* filename = "tests/testdata/data.zip";
ASSERT_EQ(zip_file_extract(filename, dst, NULL), RET_OK);
ASSERT_EQ(file_exist("temp/data/timer.json"), TRUE);
ASSERT_EQ(file_exist("temp/data/fscript1.json"), TRUE);
ASSERT_EQ(file_exist("temp/data/multi.json"), TRUE);
ASSERT_EQ(file_get_size("temp/data/multi.json"), 2132);
ASSERT_EQ(file_get_size("temp/data/timer.json"), 877);
fs_remove_dir_r(os_fs(), dst);
}