Branch data Line data Source code
1 : : /** @file
2 : : * @brief Unit tests for App.
3 : : *
4 : : * It contains unit tests to test the App.
5 : : */
6 : :
7 : : #include "app.hpp"
8 : : #include "gmock/gmock.h"
9 : : #include "gtest/gtest.h"
10 : : #include "lib/lib.hpp"
11 : : #include "lib/libMock.hpp"
12 : :
13 : : /** @test
14 : : * @brief Test returning with 0.
15 : : *
16 : : * It tests if App::main function returns with 0 (success).
17 : : */
18 : 4 : TEST(AppTestSuite, testMain_Return0) {
19 : : // GIVEN
20 : 1 : const lib::Lib lib;
21 : :
22 : : // WHEN
23 : 1 : auto returnValue{app::App{lib}.main()};
24 : :
25 : : // THEN
26 [ - + ]: 1 : EXPECT_EQ(returnValue, 0);
27 : 1 : }
28 : :
29 : : /** @test
30 : : * @brief Test calling the expected function.
31 : : *
32 : : * It tests if App::main function calls the expected function
33 : : * (LibMock::createUpperString).
34 : : */
35 : 4 : TEST(AppTestSuite, testMain_CallCreateUpperString) {
36 : : // GIVEN
37 : 1 : const lib::LibMock lib;
38 : 1 : EXPECT_CALL(lib, createUpperString("Hello Big World!")).Times(1);
39 : :
40 : : // WHEN
41 : 1 : auto returnValue{app::App{lib}.main()};
42 : :
43 : : // THEN
44 [ - + ]: 1 : EXPECT_EQ(returnValue, 0);
45 : 1 : }
|