# Check Plus: An EDSL for writing unit tests in C

DevFeed: [Check Plus: An EDSL for writing unit tests in C](<https://devfeed.tech/articles/check-plus-an-edsl-for-writing-unit-tests-in-c-21908.md>)

Original publisher: [Read original article](<https://blog.nelhage.com/2010/06/check-plus-an-edsl-for-writing-unit-tests-in-c/>)

Author: Nelson Elhage

Published: 2010-06-26T15:54:53Z

Content type: article

Language: en

Sources: [Nelson Elhage](<https://devfeed.tech/sources/nelson-elhage.md>)

Topics: [C](<https://devfeed.tech/topics/c.md>), [Unit testing](<https://devfeed.tech/topics/unit-testing.md>), [Library](<https://devfeed.tech/topics/library.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [code](<https://devfeed.tech/tags/code.md>), [library](<https://devfeed.tech/tags/library.md>), [testing](<https://devfeed.tech/tags/testing.md>), [unit-testing](<https://devfeed.tech/tags/unit-testing.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>)

## AI overview

The article introduces Check Plus, a single-header C library that uses preprocessor tricks and GNU C extensions to provide a declarative embedded DSL for declaring and collecting Check unit-test cases and suites. It compares this approach with Check's manual test collection interface.

## Source excerpt

Check is an excellent unit-testing framework for C code, used by a number of relatively well-known projects. It includes features such as running all tests in separate address spaces (using fork(2)), which means that the test suite can properly report segfaults or similar crashes without the test runner crashes. My main complaint about Check is that (unsurprisingly for a framework written in C), it's not very declarative. After you define all your tests as separate functions, you need to write code to manually collect them into "test cases", which you then collect into "test suites", which you can then run.