Skip to content

Commit

Permalink
Updated sample program logics and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bialger committed Jan 22, 2024
1 parent 3ef4435 commit e018a47
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is a project template. Feel free to use it. It contains all pre-configured
CMakeLists.txt, so to use it, just replace project name with your in
[main CmakeLists.txt](CMakeLists.txt), and all target and executable names in
[CI/CD script](./.github/workflows/ci_tests.yml).
[CI/CD script](./.github/workflows/ci_tests.yml). Sample program prints first argument.

## How to run

Expand Down Expand Up @@ -32,13 +32,13 @@ cmake --build cmake-build --target cpp_tests_tests
* On Windows:

```shell
.\cmake-build\bin\cpp_tests.exe || .\cmake-build\bin\Debug\cpp_tests.exe
.\cmake-build\bin\cpp_tests.exe "Hello, World" || .\cmake-build\bin\Debug\cpp_tests.exe "Hello, World"
```

* On POSIX:

```shell
./cmake-build/bin/cpp_tests
./cmake-build/bin/cpp_tests "Hello, World"
```

5. Run tests
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/ui_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ int32_t StartConsoleUI(const std::vector<std::string>& args, std::ostream& out)
}

MyClass printer(out);
printer.Print("Hello, World!\n");
printer.Print(args[1] + "\n");
return 0;
}
10 changes: 5 additions & 5 deletions tests/main_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

#include <gtest/gtest.h>
#include "ProjectIntegrationTestSuite.hpp"
#include "test_functions.hpp" // include your library here
#include "lib/ui/ui_functions.hpp"
#include "test_functions.hpp"
#include "lib/ui/ui_functions.hpp" // include your library here

TEST_F(ProjectIntegrationTestSuite, InitTest) {
ASSERT_TRUE(std::filesystem::is_directory(kTemporaryDirectoryName));
}

TEST_F(ProjectIntegrationTestSuite, PositiveTest1) {
std::ostringstream out;
ASSERT_EQ(StartConsoleUI(SplitString("test -h"), out), 0);
ASSERT_EQ(StartConsoleUI(SplitString("test Hello!"), out), 0);
}

TEST_F(ProjectIntegrationTestSuite, PositiveOutputTest1) {
std::ostringstream out;
StartConsoleUI(SplitString("test -h"), out);
ASSERT_EQ(out.str(), "Hello, World!\n");
StartConsoleUI(SplitString("test Hello!"), out);
ASSERT_EQ(out.str(), "Hello!\n");
}

TEST_F(ProjectIntegrationTestSuite, NegativeTest1) {
Expand Down

0 comments on commit e018a47

Please sign in to comment.