Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsdevel/cpp-unit-testing
A single header file is all you need :)
https://github.com/jsdevel/cpp-unit-testing
Last synced: 18 days ago
JSON representation
A single header file is all you need :)
- Host: GitHub
- URL: https://github.com/jsdevel/cpp-unit-testing
- Owner: jsdevel
- Created: 2014-01-20T07:00:35.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-20T19:09:46.000Z (almost 11 years ago)
- Last Synced: 2024-07-31T22:58:36.562Z (3 months ago)
- Language: C
- Size: 148 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
cpp-unit-testing
================A single header file is all you need :)
The goal of this project is to allow testing of c++ to remain easy and flexible, without the need to install libraries. You can simply copy the header file into your project to get started.
##Example
````cpp
#include
#include
#include "../../src/cc/PWM.h"using namespace std;
#define USE_BEFORE 1
#define USE_AFTER 1
#include "helpers/assert.h"
namespace test {
PWM * pwm;void before(){
pwm = new PWM(5, 30, 1000);
}void after(){
pwm = 0;
}void valid_pins_for_constructor_throw_no_error(){
int pins [17] = {3, 5, 7, 8, 10, 11, 12, 13, 15, 16, 18, 19, 21, 22, 23, 24, 26};
for(int i = 0;i<17;i++){
PWM pwm(pins[i], 0, 1);
}
}void invalid_pins_for_constructor_throw_error(){
int pins [5] = {1, 2, 0, 40, 50};
for(int i = 0;i<5;i++){
try {
PWM pwm(pins[i], 0, 1);
fail("didn't throw for");
} catch(...){
continue;
}
}
}
}int main(){
SUITE();
TEST(valid_pins_for_constructor_throw_no_error);
TEST(invalid_pins_for_constructor_throw_error);
END();
}
````