add some dependencies and test code

This commit is contained in:
2025-03-17 22:54:34 +02:00
parent 21bf4d8715
commit b0be5aec60
23 changed files with 1993 additions and 43 deletions

1
test/CMakeLists.txt Normal file
View File

@@ -0,0 +1 @@
add_subdirectory(manual)

View File

@@ -1,6 +1,6 @@
project(Minimal)
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_executable(minimal
minimal.cpp
)

View File

@@ -8,9 +8,12 @@ int main(int argc, char *argv[]) {
int modified = -1;
while (modified != 0) {
modified = minimal_lib::getModified(5);
printf("getModified(5): %d\n", modified);
modified = minimal_lib::getNewValue(5);
printf("getModified(5): %d\n", modified);
std::this_thread::sleep_for(std::chrono::seconds(1));
printf("otherValue: %d\n", minimal_lib::otherValue);
std::this_thread::sleep_for(std::chrono::seconds(1));
}

View File

@@ -2,6 +2,10 @@
namespace minimal_lib {
int getModified(int x) { return x + 1; }
int getNewValue(int x) {
static int value = 0;
value = value + x;
return value;
}
} // namespace minimal_lib

View File

@@ -3,9 +3,9 @@
namespace minimal_lib {
static int value = 5;
static int otherValue = 5;
int getModified(int x);
int getNewValue(int x);
}
#endif // MINIMAL_LIB_H_