Skip to content

Latest commit

 

History

History
88 lines (71 loc) · 4.07 KB

README.md

File metadata and controls

88 lines (71 loc) · 4.07 KB

ft_containers-modular-tester

Yes another Tester for ft_containers! This one is written completely in C++98 and can be executed trough make

How to Use

git clone https://github.com/toni-schmitt/ft_containers-modular-tester.git
  1. Clone the tester into your ft_containers directory.
    • If needed: Configure the Path to your .hpp files in the Makefile. (make config for help)
  2. Print all available commands with make help
  3. Test until everythig is Successful
    • Execute all tests with make test
    • Execute a single test with make test C=container T=test (for example: make test C=vector T=modifiers or make test CONTAINER=vector TEST=modifiers)
    • Execute all tests without Benchmarking with make no_bench

usage3

How to add Test Case

Adding a Test Case is super easy, just follow these steps (I added 'insert_basic' Test Case to 'vector')

1. Add the Test Case (class)

Show GIF

clion_add_test_case_class

Show Description
  1. Add a .hpp file under tests/src/tests/[Container] ([Container] being the Container you want to add a Test Case) (it is advised to follow the existing Naming Convention for your newly added .hpp file)
  2. Copy the contents from tests/src/tests/example_test.hpp into your newly added .hpp file
  3. Modify the copied content in your newly added .hpp file
    1. Modify CONTAINER_NAME to the Container ([Container]) you wanted to add a Test Case to
      1. Important: CONTAINER_NAME has to be the same as [Container] (the Folder)
    2. Modify TEST_CASE_NAME to your Test Case Name (the Name does not have to be the same as the .hpp file, but it is advised to do so)
  4. Add your own Tests
    1. Every Test works with log files, it is advised to write a lot of stuff into these log files
      1. You can write to the Log file with ofs and with the write:: namespace defined in tests/src/utility/write.hpp

2. Add a Test object

Show GIF

clion_add_test_case_test_object

Show Description
  1. Go to tests/src/tests/[Container]/test_objects.hpp
  2. #include you newly added .hpp file
  3. Find the correct place for the new Test Object
    1. The Test Objects are orderd alphabetically, first listing generic:: Test Objects (if any) and then listing [Container]:: Test Objects
  4. Add a Test Object for ::std[] (with Template parameter ContainerSTD)
  5. Add a Test Object for ::ft[] (with Template parameter ContainerFT)
The Tester automatically deletes all Test Objects atexit

3. Add the Test Case to available_tests

Show GIF

clion_add_test_case_available_test

Show Description
  1. Go to tests/src/config.hpp
  2. Add the Name of your added Test to available_tests::[Container]
    1. Important: The Index of the newly added string has to be the same as in test_objects.hpp
  3. Adjust the ::[Container]_size

4. Run your newly added Test Case

Show GIF

clion_add_test_case_run