{"id":21340727,"url":"https://github.com/artainmo/ft_containers-unittest","last_synced_at":"2025-03-16T02:42:51.937Z","repository":{"id":93053025,"uuid":"318826754","full_name":"artainmo/ft_containers-unittest","owner":"artainmo","description":"Personal project. An advanced unit-test written in c++ for 42 school's ft_containers project or other c++ containers.","archived":false,"fork":false,"pushed_at":"2023-10-01T18:04:46.000Z","size":847,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-22T15:32:12.735Z","etag":null,"topics":["42school","cpp","forks","personal-project","threads","unittest"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artainmo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-05T15:50:20.000Z","updated_at":"2023-02-28T22:04:26.000Z","dependencies_parsed_at":"2025-01-22T15:41:25.997Z","dependency_job_id":null,"html_url":"https://github.com/artainmo/ft_containers-unittest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artainmo%2Fft_containers-unittest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artainmo%2Fft_containers-unittest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artainmo%2Fft_containers-unittest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artainmo%2Fft_containers-unittest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artainmo","download_url":"https://codeload.github.com/artainmo/ft_containers-unittest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243817873,"owners_count":20352625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["42school","cpp","forks","personal-project","threads","unittest"],"created_at":"2024-11-22T00:52:47.911Z","updated_at":"2025-03-16T02:42:51.909Z","avatar_url":"https://github.com/artainmo.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ft_containers-unittest\nAn advanced unit-test written in c++ for 42 school's [ft_containers](https://github.com/artainmo/ft_containers) project or other c++ containers.\n\nFor the 'list' container we generate 162555 tests for example.\n\nAs explained below we use threads and forks to speed up the testing.\n\n### PREPARE\n\n* Change **path** to your container's '.hpp' in '**main.hpp**'\n\n* **Optional**: Set G_ERROR_LIMIT in 'main.cpp' to keep testing until the error limit is attained\n\n* **Optional**: Set G_STOP_AT_TEST in 'main.cpp' to keep testing independently of errors\n\n### USE NON-CONST UNITTEST\nLaunch non-const unittest\n```\nmake \u003clist/stack/map/queue/vector\u003e\n```\nSee **results** by comparing '/output/me' with '/output/real'.\u003cbr\u003e\nInfinite loop results can be checked in 'output/tmp_my' and 'output/tmp_real'.\n\nSee **tests** in '/src'.\n\n### USE CONST UNITTEST\nLaunch const unittest\n```\nmake const\n```\nYou should have a certain amount of compilation errors not more or less.\n\n### NOTES\nBecause this unittest is very advanced I doubt it will be used by others, as validating it is probably way more complex than what is demanded in 42 school project ft_containers.\n\nUsing processes to test segfaults and sigabort, so that the error gets catched and exits the child process.\u003cbr\u003e\nFor error messages that cannot be catched like memory freed not allocated, we redirect the stderr to /dev/null.\u003cbr\u003e\nInfinte loops cannot be catched unfortunately, but result can be viewed in output/tmp_my and output/tmp_real.\u003cbr\u003e\nTemp files are used, if program blocks and ctrl-c is used to quit program, tmp files won't be deleted and can be viewed to debug, useful for infinite loops.\u003cbr\u003e\n\nThreads used with the failed idea of increasing the programs speed, failed due to impossibility to write to multiple fds at the same time.\u003cbr\u003e\nBut in the end threads increased program speed a lot by increasing the speed of fork.\u003cbr\u003e\nFork gets slower as parent process uses more memory both stack and heap memory, due to its copying feature, using threads detaches from parent process and speeds up the forks, threads increased program speed 5X.\n\nWhen excess test errors are written to file, fills up computer memory and creates bug.\u003cbr\u003e\nSolution is to not check in the end but after each test and only write errors to files, max number errors before quiting.\u003cbr\u003e\n\nCombination of tests are generated based on different container objects.\u003cbr\u003e\n\n\n### NOT TESTED\nTo test vector container correctly set its buffer_size to 10.\u003cbr\u003e\nAllocator_type.\u003cbr\u003e\nUndefined behavior; unintialized memory, SIGABORT, SEGFAULT, ...\u003cbr\u003e\nMax size as you can have different answer than real one. You must be able to explain, your own implementation of it.\u003cbr\u003e\nDestructor is not tested and memeory leaks are not tested.\u003cbr\u003e\nSpecial types like std::string.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartainmo%2Fft_containers-unittest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartainmo%2Fft_containers-unittest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartainmo%2Fft_containers-unittest/lists"}