📝 One of the difficult unit tester for ft_containers project

Overview

ft_containers-unit-test

screenshot

About

ft containers unit test is a complete testing for project of school 21/ecole 42 and allowing you test your containers: Vector, Stack, Map, Set and Utilities in ft namespace.
This test checks 90% of subject and checklist requires: using std allocator, iterator traits, benchmark, leaks, segfaults, timeouts etc. But keep in mind that test doesn't check something you don't need to implement and was written by students, so im waiting for your bugs or suggestions for improving

Getting started

⚙️ Installation

run this command inside your ft_containers folder:

git clone https://github.com/divinepet/ft_containers-unit-test

then

cd ft_containers-unit-test

now you need to configure file config.hpp and write correct names of all your files and classes, and the last step is

./start.sh

⚠️ config.hpp

if you haven't some class implementation yet, for example Map, you need to comment appropriate line:

...
// #define MAP     "../../../Map.hpp"
...

and etc. for other. The same with flags - comment this line to turn off them

// #define FLAGS

📄 start.sh

you can run tests with a specific container, use flags for this

./start.sh -v # for vector
./start.sh -u # for utilities
./start.sh -st # for stack
./start.sh -m # for map
./start.sh -s # for set
./start.sh -h # help with commands

Results

NOT COMPILED means that method compiles with errors, also probably some template name in config.hpp is incorrect
TIMEOUT means the method exceeded the maximal execution time, probably due to an infinite loop

Press Star button in the right corener if this test was useful to you, so that more people can see it

You might also like...
Kernel-mode C++ unit testing framework in BDD-style

There is a lack of unit testing frameworks that work in OS kernel. This library closes that gap and is targeted for windows driver developers.

C unit tests with a small header-only library.
C unit tests with a small header-only library.

C unit tests Minimalistic unit tests in C. Uses the __attribute__((constructor)) which, as far as I know, is supported by GCC and clang. So this proba

A simple, cross-platform, and continuously integrated C++14 project template

Project Name A simple, cross-platform, and continuously integrated C++14 project template. Making cross platform C++ projects is widely known to be a

Project basicly find the test that fails some code.

Stress Test project Overview many and many times in competitve programming when you have a solution got WA(wrong answer) and you do not know why and c

✔️The smallest header-only GUI library(4 KLOC) for all platforms
✔️The smallest header-only GUI library(4 KLOC) for all platforms

Welcome to GUI-lite The smallest header-only GUI library (4 KLOC) for all platforms. 中文 Lightweight ✂️ Small: 4,000+ lines of C++ code, zero dependenc

Starting with OpenCV and Qt on MacOS is a bit of difficult if you haven't installed and used libraries in XCode.
Starting with OpenCV and Qt on MacOS is a bit of difficult if you haven't installed and used libraries in XCode.

OpenCV and Qt on MacOS Introduction Starting with OpenCV and Qt on MacOS is a bit of difficult if you haven't installed and used libraries in XCode. T

A tester for the ft_printf 42 project.

ft_printf tester A tester for 42's ft_printf project. Updated for the new specification (2021 2nd semester) It runs a series of tests against ft_print

A Tester for the Libft 42 project based off Tripouille

libfttester A Tester for the Libft 42 project This Tester was made by NotJustJoe, using Tripouille Leaks checker and kind of inspired off his work (ht

The C Unit Testing Library on GitHub is a library designed for easy unit testing in C

The C Unit Testing Library on GitHub is a library designed for easy unit testing in C. It was written by Brennan Hurst for the purpose of providing a J-Unit-like testing framework within C for personal projects.

C++ Unit Testing Easier: A Header-only C++ unit testing framework

CUTE C++ Unit Testing Easier: A Header-only C++ unit testing framework usually available as part of the Cevelop C++ IDE (http://cevelop.com) Dependenc

A tester for game controller written in C, using SDL2.

SDL2 Controller Tester This little application has been made while I was attending a tutorial to make games in C using SDL2. Since my purpose will be

Simple ft_printf (2021) tester for the mandatory requirements
Simple ft_printf (2021) tester for the mandatory requirements

Welcome to the MK_Test 👋 Simple ft_printf (2021) tester for the mandatory requirements Disclaimers This tester only checks the MANDATORY requirements

The ultimate battery tester with ESR measurement and discharge graph. Based on an Arduino Nano and a 1602 LCD.
The ultimate battery tester with ESR measurement and discharge graph. Based on an Arduino Nano and a 1602 LCD.

Ultimate-Battery-Tester Version 1.0.0 Features Measures the ESR (equivalent series resistance) of the battery. This is an idicator of the health of th

A push_swap tester
A push_swap tester

complexity Usage ./complexity [-hs] [-p file ] numbers iterations [ goal ] [ checker ] L'exécutable push_swap est cherché par défaut dans le répertoir

Optimized Collatz Conjecture tester.

Collatz Conjecture tester This optimized Collatz Conjecture tester can test the provided numbers for how many iterations they need before they reach t

Dperf is a 10M HTTP CPS Load Tester.

Dperf is a 10M HTTP CPS Load Tester Dperf is a high performance network load tester. Thanks to DPDK and highly optimized network protocol stack, it ca

Design and Implementation of kernel level threads for xv6 operating system. Adding system call related to threading environment in xv6 along with userland threading library with one to one mapping and semaphore implementation as synchronisation primitive   A kernel designed to run one and only one application in a virtualized environment
A kernel designed to run one and only one application in a virtualized environment

A kernel designed to run one and only one application in a virtualized environment

Comments
  • Cannot compile on linux

    Cannot compile on linux

    Hello! I'm trying to run your tester on linux and i always get this error that i can't fix even on the 42's Xubuntu VM

    image

    Is your tester supposed to be run only on mac? or is there some workaround to make it compile on linux?

    opened by frdescam 2
  • bug: swap test in vector does not test ft::swap

    bug: swap test in vector does not test ft::swap

    template std::vector swap_test( _vector vector ) { std::vector v; vector.assign( 1100 * _ratio, 11 ); _vector tmp( 500 * _ratio, 5 ), tmp2( 1000 * _ratio, 10 ), tmp3( 1500 * _ratio, 15 ), tmp4( 3000 * _ratio, 30 ); g_start2 = timer(); v.push_back( vector[2] ); v.push_back( vector.size() ); v.push_back( vector.capacity() ); long *adr1 = reinterpret_cast<long *>( &vector ); long *adr2 = reinterpret_cast<long *>( &tmp ); vector.swap( tmp ); if ( reinterpret_cast<long *>( &vector ) == adr1 && reinterpret_cast<long *>( &tmp ) == adr2 ) v.push_back( 1 ); v.push_back( vector[2] ); v.push_back( vector.size() ); v.push_back( vector.capacity() ); vector.swap( tmp3 ); v.push_back( vector[2] ); v.push_back( vector.size() ); v.push_back( vector.capacity() ); std::swap( vector, tmp2 ); --> ft::swap(...) v.push_back( vector[2] ); v.push_back( vector.size() ); v.push_back( vector.capacity() ); std::swap( vector, tmp4 ); --> ft::swap(...) g_end2 = timer(); v.push_back( vector[2] ); v.push_back( vector.size() ); v.push_back( vector.capacity() ); return v; }

    opened by lscitl 0
  • bug: iterator_traits test is wrong

    bug: iterator_traits test is wrong

    I think sources/utilities_tests/iterator_traits.cpp file is doing wrong test!

    It is doing test for std::vector's iterator types and ft::vector's iterator types is same.

    but we need to test for ft::iterator_traits is doing well like this

    bool iterator_traits_test() {
      std::vector<string> res;
      std::vector<string> res2;
      g_start1 = g_end1 = timer();
    
      res.push_back(typeid(std::iterator_traits<std::map<int, int>::iterator>::iterator_category).name());
      res.push_back(typeid(std::iterator_traits<std::map<int, int>::iterator>::value_type).name());
      res.push_back(typeid(std::iterator_traits<std::map<int, int>::iterator>::difference_type).name());
      res.push_back(typeid(std::iterator_traits<std::map<int, int>::iterator>::pointer).name());
      res.push_back(typeid(std::iterator_traits<std::map<int, int>::iterator>::reference).name());
      res.push_back(typeid(std::iterator_traits<std::map<int, int>::reverse_iterator>::iterator_category).name());
      res.push_back(typeid(std::iterator_traits<std::map<int, int>::reverse_iterator>::value_type).name());
      res.push_back(typeid(std::iterator_traits<std::map<int, int>::reverse_iterator>::difference_type).name());
      res.push_back(typeid(std::iterator_traits<std::map<int, int>::reverse_iterator>::pointer).name());
      res.push_back(typeid(std::iterator_traits<std::map<int, int>::reverse_iterator>::reference).name());
    
      res2.push_back(typeid(ft::iterator_traits<std::map<int, int>::iterator>::iterator_category).name());
      res2.push_back(typeid(ft::iterator_traits<std::map<int, int>::iterator>::value_type).name());
      res2.push_back(typeid(ft::iterator_traits<std::map<int, int>::iterator>::difference_type).name());
      res2.push_back(typeid(ft::iterator_traits<std::map<int, int>::iterator>::pointer).name());
      res2.push_back(typeid(ft::iterator_traits<std::map<int, int>::iterator>::reference).name());
      res2.push_back(typeid(ft::iterator_traits<std::map<int, int>::reverse_iterator>::iterator_category).name());
      res2.push_back(typeid(ft::iterator_traits<std::map<int, int>::reverse_iterator>::value_type).name());
      res2.push_back(typeid(ft::iterator_traits<std::map<int, int>::reverse_iterator>::difference_type).name());
      res2.push_back(typeid(ft::iterator_traits<std::map<int, int>::reverse_iterator>::pointer).name());
      res2.push_back(typeid(ft::iterator_traits<std::map<int, int>::reverse_iterator>::reference).name());
    
      return res == res2;
    }
    
    opened by 42mypark 0
  • some problems

    some problems

    Hi! Amazing test but here are some issues.

    1. Set erase(val):55 line. I think this is undefined to do post decrement on empty set iterator. To see it, try run with -g -fsanitize=address. My tree, which is almost same as stl2.03 has SEGV here, this really weird that my macOS STL pass this fine.

    2. Testing capacity in vector seems to be not quite correct, since we not required do accurate copy of std vector for particular implementation on particular machine.

    3. Also im faced with interesting things that my iterator in vector (which is just raw pointer ), not supports ++vect.begin() operation. And referring to ISO98 standard it doesn't have to. Maybe im a little wrong in implementation, but still has no solution for this. I think it's better to keep this problem to involve more people

    Thank you for this great tests! It helped me a lot.

    opened by tonypony220 1
Owner
Erik
school 21 student, java developer trainee
Erik
C++ Unit Testing Easier: A Header-only C++ unit testing framework

CUTE C++ Unit Testing Easier: A Header-only C++ unit testing framework usually available as part of the Cevelop C++ IDE (http://cevelop.com) Dependenc

Peter Sommerlad 35 Aug 31, 2022
A modern, C++-native, header-only, test framework for unit-tests, TDD and BDD - using C++11, C++14, C++17 and later (or C++03 on the Catch1.x branch)

Catch2 v3 is being developed! You are on the devel branch, where the next major version, v3, of Catch2 is being developed. As it is a significant rewo

Catch Org 15.9k Nov 28, 2022
A dynamic mock tool for C/C++ unit test on Linux&MacOS X86_64

lmock 接口 替换一个函数,修改机器指令,用新函数替换旧函数,支持全局函数(包括第三方和系统函数)、成员函数(包括静态和虚函数)

null 52 Nov 22, 2022
A modern, C++11-native, single-file header-only, tiny framework for unit-tests, TDD and BDD (includes C++98 variant)

lest – lest errors escape testing This tiny C++11 test framework is based on ideas and examples by Kevlin Henney [1,2] and on ideas found in the CATCH

Martin Moene 353 Nov 16, 2022
UT: C++20 μ(micro)/Unit Testing Framework

"If you liked it then you "should have put a"_test on it", Beyonce rule UT / μt | Motivation | Quick Start | Overview | Tutorial | Examples | User Gui

boost::ext 928 Nov 22, 2022
A micro unit-testing library for C/C++

µ-test A micro unit testing framework for C/C++ to get you up and running with unit-testing ASAP (even without libc). Usage Simply include the C and h

Trevor McKay 1 Dec 8, 2021
A complete unit testing framework in a header

liblittletest A complete unit testing framework in a header liblittletest is an easy to use all-in-an-header testing framework; all you have to do in

Sebastiano Merlino 13 Nov 11, 2021
Modern c++17 unit testing framework on Microsoft Windows, Apple macOS, Linux, iOS and android.

tunit Modern c++17 unit testing framework on Windows, macOS, Linux, iOS and android. Continuous Integration build status Operating system Status Windo

Gammasoft 8 Apr 5, 2022
Various Framework to do Unit Test in C++

Unit Test in C++ There are many frameworks to performs unit test in C++, we will present the most popular ones and show how to use them. The testing f

Yassine 2 Nov 18, 2021
Upp11 - C++11 lightweight single header unit test framework

upp11 Lightweight C++11 single header unit test framework To use framework: Copy upp11.h in you project dir. Create unit test source files or modify e

Andrey Valyaev 8 Apr 4, 2019