{"id":15047300,"url":"https://github.com/nemtrif/ftest","last_synced_at":"2025-05-15T12:31:25.797Z","repository":{"id":44435913,"uuid":"361240328","full_name":"nemtrif/ftest","owner":"nemtrif","description":"A simple and limited unit-test framework for C++ 98","archived":false,"fork":false,"pushed_at":"2024-03-23T22:55:29.000Z","size":19,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T09:12:15.851Z","etag":null,"topics":["cpp","cpp98","testing","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nemtrif.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-04-24T18:43:14.000Z","updated_at":"2025-03-16T06:50:30.000Z","dependencies_parsed_at":"2023-12-04T01:22:19.781Z","dependency_job_id":"ad39c1f0-e4ce-47ca-a9a7-e3da486e9784","html_url":"https://github.com/nemtrif/ftest","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtrif%2Fftest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtrif%2Fftest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtrif%2Fftest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtrif%2Fftest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nemtrif","download_url":"https://codeload.github.com/nemtrif/ftest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254341115,"owners_count":22054983,"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":["cpp","cpp98","testing","unit-testing"],"created_at":"2024-09-24T20:56:14.478Z","updated_at":"2025-05-15T12:31:23.299Z","avatar_url":"https://github.com/nemtrif.png","language":"C++","readme":"# FTEST - A Simple and Portable Testing Framework for C++\nI developed FTest to test [UTF-8 CPP library](https://github.com/nemtrif/utfcpp). Previously, I was using [GoogleTest](https://google.github.io/googletest/) framework. Over time it became increasingly hard to use it with C++ 98. As I was using only a small subset of its features anyway, I decided to write a new testing framework. The important features of the framework are:\n\n- Uses only C++ 98\n- Asserts are similar to a subset of Google Test's ones.\n- It is simple to get started with - just a single header file\n\nYou may want to use FTest if you want to quickly set-up a testing framework with an easy path to migrating to GoogleTest once you need more features.\n\nAnother use-case scenario for FTest is when you need to compile your code (including the tests) with C++ 98.\n\nOr, you may just like the simplicity and small size of FTest and do not need the features offered by bigger testing frameworks.\n\n\n## A simple example\nTo see real-life use of FTest, I suggest checking the tests directory of UTF-8 CPP project. That said, here is a simple example of using FTest:\n\n```\n#include \"ftest.h\"\n\nTEST(Simple, simple)\n{\n    EXPECT_TRUE(true);\n}\n```\n\nSave the content to a cpp file, compile it and run it. The output should look like:\n```\n[==========] Running 8 tests from 3 test cases.\n[----------] 1 tests from Simple\n[ RUN      ] Simple.simple\n[       OK ] Simple.simple\n[----------] 1 tests from Simple\n[==========] 1 tests from 1 test cases ran.\n[  PASSED  ] 1 tests.\n```\n\nSome things to note:\n- The test program contains no `main()` function. It is provided by FTest, unless you define `F_TEST_NO_MAIN` before including ftest.h.\n- `TEST` macro takes two arguments: test case name (\"Simple\" in the previous example) and test name (\"simple\"). A test case is simply a group of related tests.\n- `EXPECT_TRUE` assertion is used to establish that a condition is true. FTest provides a limited number of assertions that can still be used to write simple and effective tests.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemtrif%2Fftest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnemtrif%2Fftest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemtrif%2Fftest/lists"}