add some dependencies and test code
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
project(Minimal)
|
||||
|
||||
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
add_executable(minimal
|
||||
minimal.cpp
|
||||
)
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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_
|
||||
|
||||
Reference in New Issue
Block a user