Project written as part of my University course. It involved implementing map using BST, and writing parser in C. It was required for student to write makefile and bash script used for testing the programme for correctness and memory leaks.
There grow many forests in the world. In every forest there are many trees. On every tree many animals can live. Every forest has a unique name and every tree in a particular forest also. Every animal living on a particular tree has a unique name. Write a programme imitating that world.
At the start of the programme there should be no forest, nor any tree or animal in the world. The programme reads characters from standard input and interprets undermentioned commands (forest, tree, animal are the unique names):
ADD forest [tree] [animal]– addsanimaltotreeinforest, or addstreetoforest, or createsforest.DEL [forest] [tree] [animal]– deletesanimalfromtreeinforest, ortreefromforest, orforestfrom the world, or deletes all beings.PRINT [forest] [tree]– prints lexicographically all forests, or all trees inforest, or all animals ontreeinforest. -CHECK forest [tree] [animal]– checks if there existsanimalontreeinforest,treeinforest, orforest.
Adding an existing being or deleting a non-existent one is ignored, same as trying to print from an empty being
or lines consiting only white characters or began with an #.
- Stdout
- For
ADDandDELprintsOK\n - For
CHECKprintsYES\norNO\ndepending on the result
- For
- Stderr
ERROR\nfor every line not matching the description
- A
makefilefile - A script for automated testing
test.sh- Run this way:
./test.sh prog dir
- Run this way:
I do not own the idea for that project. I am not the author. This is merely a rough translation and a summary. All credit goes to University of Warsaw, Faculty of Mathematics, Informatics and Mechanics.