README.md 2.43 KB
Newer Older
Mark Malone's avatar
Mark Malone committed
1
2
# hello_world

Mark Malone's avatar
Mark Malone committed
3
4
 [![pipeline status](https://code.80px.com/80px/80px.com/cpp/hello_world/badges/main/pipeline.svg)](https://code.80px.com/80px/80px.com/cpp/hello_world/-/commits/main) [![coverage report](https://code.80px.com/80px/80px.com/cpp/hello_world/badges/main/coverage.svg)](https://code.80px.com/80px/80px.com/cpp/hello_world/-/commits/main) 

Mark Malone's avatar
Mark Malone committed
5
hello_world is a c++ project to return "Hello world". Uses the [googletest](https://github.com/google/googletest) testing library. Adapted from [sample-ci-cpp](https://github.com/ginomempin/sample-ci-cpp).
Mark Malone's avatar
Mark Malone committed
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

## Prerequisites

You need `g++`, `cmake`, `git`, and `make` to run hello_world.


## Usage

### Building application and tests

```shell script
rm -rf build/
mkdir build
cd build
cmake ..
make
```

This will create two executables: `helloworld` and `helloworld_tests` in the `./build/bin` directory.


### Running the application

```bash
./bin/helloworld
```

```bash
Hello World!
```

### Running the tests

```bash
./bin/helloworld_tests
```

```bash
Running main() from .../hello_world/build/googletest-src/googletest/src/gtest_main.cc
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from HelloWorldTest
[ RUN      ] HelloWorldTest.PositiveResponse
[       OK ] HelloWorldTest.PositiveResponse (0 ms)
[----------] 1 test from HelloWorldTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
Mark Malone's avatar
Mark Malone committed
54
[  PASSED  ] 1 test.
Mark Malone's avatar
Mark Malone committed
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
```

### Getting code coverage

After building and testing your changes (see above)

```bash
./bin/helloworld_tests # Run the tests at least once to determine coverage
cd CMakeFiles/helloworld_tests.dir/
lcov -d . -c -o coverage.info
lcov -r coverage.info */build/* */tests/* */c++/* -o coverage.info # Remove coverage from includes
lcov --list coverage.info
```

```bash
Reading tracefile coverage.info
                     |Lines       |Functions  |Branches    
Filename             |Rate     Num|Rate    Num|Rate     Num
===========================================================
[.../code/hello_world/src/]
helloworld.cpp       | 100%      2| 100%     1|    -      0
===========================================================
               Total:| 100%      2| 100%     1|    -      0
```

## Contributing

See [CONTRIBUTING.md](https://code.80px.com/80px/80px.com/cpp/hello_world/-/blob/main/CONTRIBUTING.md)

## License

[MIT](https://choosealicense.com/licenses/mit/)