diff --git a/recorder.h b/recorder.h index d290cdf..e73b379 100644 --- a/recorder.h +++ b/recorder.h @@ -31,6 +31,18 @@ extern "C" { #endif // __cplusplus +// ============================================================================ +// +// Information about the API +// +// ============================================================================ + +#define RECORDER_CURRENT_VERSION RECORDER_VERSION(1,0) +#define RECORDER_VERSION(major,minor) ((major)<<16|(minor)) +#define RECORDER_VERSION_MAJOR(version) (((version) >> 16) & 0xFFFF) +#define RECORDER_VERSION_MINOR(version) ((version) & 0xFFFF) + + // ============================================================================ // diff --git a/recorder_test.c b/recorder_test.c index 4b2cde7..381d0ca 100644 --- a/recorder_test.c +++ b/recorder_test.c @@ -127,6 +127,13 @@ void flight_recorder_test(int argc, char **argv) uintptr_t count = argc >= 2 ? atoi(argv[1]) : 16; unsigned howLong = argc >= 3 ? atoi(argv[2]) : 1; + INFO("Testing recorder version %u.%u", + RECORDER_VERSION_MAJOR(RECORDER_CURRENT_VERSION), + RECORDER_VERSION_MINOR(RECORDER_CURRENT_VERSION)); + if (RECORDER_CURRENT_VERSION > RECORDER_VERSION(1,0)) + FAIL("Testing an unexpected version of the recorder, " + "update RECORDER_CURRENT_VERSION"); + for (i = 0; i < 2; i++) { recorder_count = 0;