Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
hash_test.c File Reference

Unit tests for hash functions. More...

#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <cmocka.h>
#include "cascoda-util/cascoda_hash.h"
Include dependency graph for hash_test.c:

Classes

struct  test_vector
 
struct  fnv1a_32_test_vector
 
struct  fnv1a_64_test_vector
 
struct  crc_32_test_vector
 

Macros

#define LEN(x)   (sizeof(x) - 1)
 
#define TEST(x)
 
#define TEST0(x)
 
#define R500(x)   R100(x) R100(x) R100(x) R100(x) R100(x)
 
#define R100(x)   R10(x) R10(x) R10(x) R10(x) R10(x) R10(x) R10(x) R10(x) R10(x) R10(x)
 
#define R10(x)   x x x x x x x x x x
 

Functions

int main (void)
 

Variables

struct test_vector fnv_test_str []
 
struct fnv1a_32_test_vector fnv1a_32_vector []
 
struct fnv1a_64_test_vector fnv1a_64_vector []
 
struct test_vector crc_test_str []
 
struct crc_32_test_vector crc_32_vector []
 

Detailed Description

Unit tests for hash functions.

Macro Definition Documentation

◆ LEN

#define LEN (   x)    (sizeof(x) - 1)

◆ R10

#define R10 (   x)    x x x x x x x x x x

◆ R100

#define R100 (   x)    R10(x) R10(x) R10(x) R10(x) R10(x) R10(x) R10(x) R10(x) R10(x) R10(x)

◆ R500

#define R500 (   x)    R100(x) R100(x) R100(x) R100(x) R100(x)

◆ TEST

#define TEST (   x)
Value:
{ \
x, LEN(x) \
}
#define LEN(x)
Definition: hash_test.c:45

◆ TEST0

#define TEST0 (   x)
Value:
{ \
x, sizeof(x) \
}

Function Documentation

◆ main()

int main ( void  )

Variable Documentation

◆ crc_32_vector

struct crc_32_test_vector crc_32_vector[]
Initial value:
= {{&crc_test_str[0], 0x00000000UL},
{&crc_test_str[1], 0x414fa339UL},
{&crc_test_str[2], 0x0c877f61}}
struct test_vector crc_test_str[]
Definition: hash_test.c:459

◆ crc_test_str

struct test_vector crc_test_str[]
Initial value:
= {TEST(""),
TEST("The quick brown fox jumps over the lazy dog"),
TEST("Test vector from febooti.com")}
#define TEST(x)
Definition: hash_test.c:47

◆ fnv1a_32_vector

struct fnv1a_32_test_vector fnv1a_32_vector[]

◆ fnv1a_64_vector

struct fnv1a_64_test_vector fnv1a_64_vector[]

◆ fnv_test_str

struct test_vector fnv_test_str[]