2023-10-06 06:17:09 +00:00
|
|
|
#ifndef KLIB_TESTFIXTURES_H
|
|
|
|
#define KLIB_TESTFIXTURES_H
|
2023-10-06 03:13:46 +00:00
|
|
|
|
|
|
|
|
2023-10-06 06:25:58 +00:00
|
|
|
#include <string.h>
|
2023-10-10 09:35:43 +00:00
|
|
|
#include "TLV.h"
|
2023-10-06 06:25:58 +00:00
|
|
|
|
|
|
|
|
2023-10-06 03:13:46 +00:00
|
|
|
#define ARENA_SIZE 128
|
|
|
|
#define ARENA_FILE "arena_test.bin"
|
|
|
|
|
|
|
|
/* strlen=13 */
|
|
|
|
#define TEST_STR1 "Hello, world"
|
|
|
|
#define TEST_STRLEN1 13
|
|
|
|
#define TEST_STR2 "Bye, world!!"
|
|
|
|
#define TEST_STRLEN2 13
|
|
|
|
#define TEST_STR3 "Hello, arena"
|
|
|
|
#define TEST_STRLEN3 13
|
|
|
|
|
|
|
|
/* strlen 35 */
|
|
|
|
#define TEST_STR4 "How is a raven like a writing desk?"
|
|
|
|
#define TEST_STRLEN4 35
|
|
|
|
|
2023-10-10 09:35:43 +00:00
|
|
|
|
|
|
|
namespace klib {
|
|
|
|
|
|
|
|
|
2023-10-06 06:08:35 +00:00
|
|
|
static bool
|
2023-10-06 06:17:09 +00:00
|
|
|
cmpRecord(TLV::Record &a, TLV::Record &b)
|
2023-10-06 06:08:35 +00:00
|
|
|
{
|
2023-10-10 09:35:43 +00:00
|
|
|
if (a.Tag != b.Tag) {
|
2023-10-06 06:08:35 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a.Len != b.Len) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (memcmp(a.Val, b.Val, a.Len) != 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-10-10 09:35:43 +00:00
|
|
|
} // namespace klib
|
|
|
|
|
|
|
|
|
|
|
|
#endif // KLIB_TESTFIXTURES_H
|