This repository was archived by the owner on Dec 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.cpp
More file actions
111 lines (91 loc) · 3.52 KB
/
tests.cpp
File metadata and controls
111 lines (91 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <thread>
#include <chrono>
#include "src/fflags.hpp"
#define print(...) \
printf("\n"); \
printf(__VA_ARGS__);
std::string boolToString(bool x) { return x ? "True" : "False"; }
//////////////////////////////////////////////////////
int main(int argc, char const *argv[])
{
print("Tests running for fflag-wrapper");
print("\t\"If you write tests, it means you don't believe in yourself\"\n\t-Excel, 2025\n");
std::string ffGetHomeFolder = fflags::GetHomeFolder();
if (!ffGetHomeFolder.empty())
{
print("GetHomeFolder()\n > %s\n", ffGetHomeFolder.c_str());
}
else
{
print("GetHomeFolder() returned an empty string.");
}
bool ffDirectoryExists = fflags::DirectoryExists(ffGetHomeFolder);
if (ffDirectoryExists)
{
print("DirectoryExists(%s)\n > %s\n", ffGetHomeFolder.c_str(), boolToString(ffDirectoryExists).c_str())
}
else
{
print("DirectoryExists(%s) returned %s, it should really not.\n", ffGetHomeFolder.c_str(), boolToString(ffDirectoryExists).c_str());
}
std::string example_file = ffGetHomeFolder + "\\NTUSER.DAT";
bool ffFileExists = fflags::FileExists(example_file);
if (ffFileExists)
{
print("FileExists(%s)\n > %s\n", example_file.c_str(), boolToString(ffFileExists).c_str())
}
else
{
print("FileExists(%s) returned %s, it should really not.\n", example_file.c_str(), boolToString(ffDirectoryExists).c_str());
}
std::string example_path = ffGetHomeFolder + "\\AppData\\Local\\Temp\\important_message.txt";
std::string example_content = "Made by Humans from the Earth";
bool ffWriteFile = fflags::WriteFile(example_path, example_content);
if (ffWriteFile)
{
print("WriteFile(%s, %s)\n > %s\n", example_path.c_str(), example_content.c_str(), boolToString(ffWriteFile).c_str());
}
else
{
print("WriteFile(%s, %s) returned %s, it should really not.\n", example_path.c_str(), example_content.c_str(), boolToString(ffWriteFile).c_str());
}
std::string example_dir_path = ffGetHomeFolder + "\\AppData\\Local\\Temp\\important_folder";
bool ffCreateDirectory = fflags::CreateFolder(example_dir_path);
if (ffCreateDirectory)
{
print("CreateFolder(%s)\n > %s\n", example_dir_path.c_str(), boolToString(ffCreateDirectory).c_str())
}
else
{
print("CreateFolder(%s) returned %s, it should really not.\n", boolToString(ffCreateDirectory).c_str());
}
fflags::ALLOW_BLOXSTRAP = false;
std::string ffGetClientSettings = fflags::GetClientSettings();
print("GetClientSettings() (ALLOW_BLOXSTRAP = %s)\n > %s\n", boolToString(fflags::ALLOW_BLOXSTRAP).c_str(), ffGetClientSettings.empty() ? "Returned an empty string." : (ffGetClientSettings).c_str());
fflags::ALLOW_BLOXSTRAP = true;
ffGetClientSettings = fflags::GetClientSettings();
print("GetClientSettings() (ALLOW_BLOXSTRAP = %s)\n > %s\n", boolToString(fflags::ALLOW_BLOXSTRAP).c_str(), ffGetClientSettings.empty() ? "Returned an empty string." : (ffGetClientSettings).c_str());
if (!ffGetClientSettings.empty())
{
fflags::ALLOW_BLOXSTRAP = true;
// Read a value from ClientAppSettings.json
std::string value = fflags::Read("thomas shelby");
print("The value of \"thomas shelby\" is %s", value.c_str());
// Write a value in ClientAppSettings.json
std::string fps_cap = "999";
if (fflags::Write("thomas shelby", fps_cap))
{
print("\"thomas shelby\" set to %s", fps_cap.c_str());
}
// Delete a value from ClientAppSettings.json
if (fflags::Delete("thomas shelby"))
{
print("\"thomas shelby\" deleted from ClientAppSettings.json");
}
}
return 0;
}