PROGC Selbststudium
Switch branches/tags
Nothing to show
Clone or download
Latest commit e9f6b49 Oct 10, 2018

README.md

PROGC Selbstudium Anastassios Martakos

This project contains all Selbstudiums-Aufgaben of PROGC.

The source code in this repository, excluding the contents of the lib directory, are written by Anastassios Martakos alone. Anastassios Martakos did not participate in any group to complete the Selbstudiums-Aufgaben contained within this repository.

Getting Started

In order to use this project, you first need to install all its dependencies and compile CUnit from source. To do that you will need to execute the setup.sh script located in the root of the project:

# install dependencies and compile CUnit
$ bash setup.sh

Folder Structure

.
├── bin                     # output folder for binaries
├── lib                     # external libraries, currently only CUnit
└── src                     # Selbstudiums Aufgaben including tests
    ├── 1                   # Selbstudium 1
    │   ├── 1               # Selbstudium 1.1
    │   │   └── tests       # Selbstudium 1.1 teste
    │   └── 2               # Selbstudium 1.2
    │       └── tests       # Selbstudium 1.2 tests
    ├── 2                   # Selbstudium 2
    │   └── tests           # Selbstudium 2 tests
    ├── 3                   # Selbstudium 3
    │   └── tests           # Selbstudium 3 tests
    ├── 4                   # Selbstudium 4
    │   └── tests           # Selbstudium 4 tests
    ├── 5                   # Selbstudium 5
    │   └── tests           # Selbstudium 5 tests
    └── utils               # Utils which are reused throughout all Selbstudiums-Aufgaben
        └── tests

Makefile Architecture

The idea is that there is one Makefile located in the root of the project which will call make in the subdirectries. Each subdirectory then contains its own Makefile and is responsible to compile its contents. This concept is equivalent to CMake, where each would put a CMakeLists.txt file in each subdirectory.

There are a few special Makefiles with the .mk extension located in the root of the project. Those files are intended to be included in Makefiles in order to reduce code duplication. For more information see comments in those files.

All binaries are placed in the bin folder in the root of the project. Test binaries have a test_ prefix followed by their task number: task1.out A task is equivalent to one "Selbstudium". If a "Selbstudium" contains multiple sub-tasks then the binary will be called taskx_y. Alternatively, those binaries are placed in the directory of the actual "Selbstudium".

Compiling and running sub-projects

You can either compile all Selbstudiums-Aufgaben by running make from the root of the project or compile them individually by navigating into their folders.

Compile all Selbstudiums-Aufgaben:

# in the root of this project run:
$ make

Compile individual Selbstudiums-Aufgabe:

# here we compile Selbstudiums-Aufgabe 2
$ cd src/2
$ make

Compiling and running test

Compiling tests work the same way as compiling the actual binaries except that you type make test instead.

Additionally to unit tests, there are also memory check tests run for each Selbstudiums-Aufgabe using valgrind. make file check if you have valgrind installed and run those checks if so. If you have not installed valgrind then make will omit those tests. (Please install valgrind I spent time making the applications leak and corruption free.)

NOTE: for some tests, I needed to expose static symbols, in order to tests them. In that case the test will clean the generated objects after the tests are run to prevent static symbols leaking out.

License

This project is licensed under the MIT License - see the LICENSE file for details