An open API service indexing awesome lists of open source software.

https://github.com/mfurquimdev/trying-catch

Simple project to test the CATCH framework for unit-tests.
https://github.com/mfurquimdev/trying-catch

Last synced: about 2 months ago
JSON representation

Simple project to test the CATCH framework for unit-tests.

Awesome Lists containing this project

README

          

# Using CATCH

Simple project to test the [CATCH](https://github.com/catchorg/Catch2) framework for unit-tests.

The project implements a keyboard T9 capable of dialing one char only, e.g. type `2` and get an `A`.
The enconding is the opposite, the `A` is located at key `2`. So on and so forth.

## Example output

```
$ ./bin/t9_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t9_test is a Catch v2.11.0 host application.
Run with -? for options

-------------------------------------------------------------------------------
Encode incorrect letter --> return -1
-------------------------------------------------------------------------------
test/t9_test.cpp:8
...............................................................................

test/t9_test.cpp:11:
warning:
WARN: At the top of the TEST CASE

test/t9_test.cpp:15:
warning:
WARN: Inside a scope

test/t9_test.cpp:25: FAILED:
explicitly with messages:
INFO: At the top of the TEST CASE
INFO: Test on Encode("?")
t9 := [?,-1]
I will fail after '?'

===============================================================================
test cases: 1 | 1 failed
assertions: 3 | 2 passed | 1 failed
```

## Structure of the project

- The `./bin` directory contains the binaries (executables)
- `t9_main` is a small application using the `T9` class
- `t9_test` is the suite of unit tests executable of the `T9` class
- The `./src` directory had to be separated as the `catch.hpp` also declares a main function as well as the `t9_main.cpp`
- `t9.cpp` implements a simple logic to return the one number based on the letter typed
- The `./main` directory contains the `t9_main.cpp` which generates the `t9_main` executable
- It is used to run a simple instance of the `T9` class
- The `./test` directory contains the `t9_test.cpp` which generates the `t9_test` executable
- It is used to run a series of unit tests of the `T9` class
- The `./inc` directory contains the `t9.h`, which is the header of `t9.cpp`, and the `catch.hpp`
- The `t9.h` defines how the `T9` class is structured (its variables and methods)
- The `catch.hpp` is the entire implementation of the CATCH framework
- The `./obj` directory contains objects from every `.cpp`
- `t9_main.o` generated by `t9_main.cpp`
- `t9_test.o` generated by `t9_test.cpp`
- `t9.o` generated by `t9.cpp`

```
mfurquim/trying-catch
├── bin/
│   ├── t9_main
│   └── t9_test
├── inc/
│   ├── catch.hpp
│   └── t9.h
├── main/
│   └── t9_main.cpp
├── Makefile
├── obj/
│   ├── t9_main.o
│   ├── t9.o
│   └── t9_test.o
├── README.md
├── src/
│   └── t9.cpp
└── test/
└── t9_test.cpp
```