pmt: reformat code.
Some checks failed
Mirror External Repo to GitHub / mirror (push) Has been cancelled

This commit is contained in:
2025-11-24 19:10:40 +03:00
parent f30f733c73
commit caaa0a7009
29 changed files with 747 additions and 632 deletions

View File

@@ -19,14 +19,14 @@
#include <iostream>
#include <libhelper/lib.hpp>
char *TEST_DIR = nullptr;
char* TEST_DIR = nullptr;
std::string test_path(const char *file) {
std::string test_path(const char* file) {
std::string end = std::string(TEST_DIR) + "/" + file;
return end;
}
int main(int argc, char **argv) {
int main(int argc, char** argv) {
if (argc < 2) return 2;
TEST_DIR = argv[1];
@@ -51,11 +51,13 @@ int main(int argc, char **argv) {
if (!Helper::writeFile("file.txt", "hello world"))
throw Helper::Error("Cannot write \"hello world\" in 'file.txt'");
else std::cout << "file.txt writed." << std::endl;
else
std::cout << "file.txt writed." << std::endl;
if (const auto content = Helper::readFile("file.txt"); !content)
throw Helper::Error("Cannot read 'file.txt'");
else std::cout << "'file.txt': " << *content << std::endl;
else
std::cout << "'file.txt': " << *content << std::endl;
std::cout << "Making directory 'dir2': " << std::boolalpha
<< Helper::makeDirectory(test_path("dir2")) << std::endl;
@@ -80,7 +82,8 @@ int main(int argc, char **argv) {
if (const auto sha256 = Helper::sha256Of(test_path("file2.txt")); !sha256)
throw Helper::Error("Cannot get sha256 of 'file2.txt'");
else std::cout << "SHA256 of 'file2.txt': " << *sha256 << std::endl;
else
std::cout << "SHA256 of 'file2.txt': " << *sha256 << std::endl;
std::cout << "'file2.txt' and 'file2lnk.txt' same? (SHA256): "
<< std::boolalpha
@@ -130,7 +133,7 @@ int main(int argc, char **argv) {
std::cout << "pure tuple test: " << std::boolalpha
<< static_cast<bool>(values.at(0)) << std::endl;
for (const auto &[x, y, z] : values) {
for (const auto& [x, y, z] : values) {
std::cout << std::boolalpha << "(" << x << ", " << y << ", " << z << ")"
<< std::endl;
}
@@ -141,7 +144,7 @@ int main(int argc, char **argv) {
LOG(WARNING) << "Warning message" << std::endl;
LOG(ERROR) << "Error message" << std::endl;
LOG(ABORT) << "Abort message" << std::endl;
} catch (std::exception &err) {
} catch (std::exception& err) {
std::cout << err.what() << std::endl;
return 1;
}