Example of a simple PicoTest suite.
Included by other examples to demonstrate how the same suite can be integrated in a variety of situations.
#include <malloc.h>
#include <stdlib.h>
#include <time.h>
testCase1, testCase2, subSuite, testCase3
)
testCase4, testCase5
)
static int staticVar = 0;
staticVar = 1;
srand(1234);
}
staticVar = 0;
srand(clock());
}
int var1;
const char *var2;
void *var3;
};
staticVar = 2;
context->var1 = 1;
context->var2 = "test";
context->var3 = (void *) malloc(1);
}
staticVar = 0;
free(context->var3);
}
void *buffer;
};
staticVar = 3;
if (context) {
staticVar++;
context->buffer = (void *) malloc(1);
}
}
staticVar = 0;
if (context) {
free(context->buffer);
}
}
#define FAILS 0
#define PASSES 1
}
}
}
}
}
#define PICOTEST_VERIFY(x,...)
Soft assertion.
Definition picotest.h:788
#define PICOTEST_ASSERT(x,...)
Hard assertion.
Definition picotest.h:751
#define PICOTEST_FIXTURE_TEARDOWN(...)
Test fixture cleanup.
Definition picotest.h:1115
#define PICOTEST_FIXTURE_SETUP(...)
Test fixture initialization.
Definition picotest.h:1060
#define PICOTEST_FIXTURE_CONTEXT(_fixtureName)
Test fixture context declaration.
Definition picotest.h:1024
#define PICOTEST_CASE(...)
Test case declaration.
Definition picotest.h:524
#define PICOTEST_SUITE(_suiteName,...)
Test suite declaration.
Definition picotest.h:1387
This file defines a minimalist unit testing framework for C programs.