Skip to content

Commit

Permalink
Update example code in README.md, add teardown(), fix method names an…
Browse files Browse the repository at this point in the history
…d namespace issues
  • Loading branch information
bxparks committed Apr 6, 2018
1 parent 31aa987 commit 4f6a241
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,10 @@ Here is a rough outline of an AUnit unit test sketch:
#line 2 AUnitTest.ino
#include <AUnit.h>
using aunit::TestRunner;
using namespace aunit;
test(example_test) {
... code ...
assertEqual(a, b);
... assertXxx() ...
}
testing(looping_test) {
Expand All @@ -214,14 +212,20 @@ testing(looping_test) {
class CustomTestOnce: public TestOnce {
protected:
virtual void setup() {
...common setup code...
// optional
virtual void setup() override {
TestOnce::setup();
...set up code...
}
// optional
virtual void teardown() override {
...tear down code...
TestOnce::teardown();
}
void assertBigStuff() {
... common higher level assertions ...
assertEqual(c, d);
...
... higher level assertions ...
}
};
Expand All @@ -233,13 +237,20 @@ testF(CustomTestOnce, example_test) {
class CustomTestAgain: public TestAgain {
protected:
// optional
virtual void setup() override {
...
TestAgain::setup();
...set up code...
}
void assertHelper() {
assertEqual(c, c);
...
// optional
virtual void teardown() override {
...tear down code...
TestOnce::teardown();
}
void assertBigStuff() {
...various assertions...
}
};
Expand Down

0 comments on commit 4f6a241

Please sign in to comment.