Skip to content
Permalink
d9c77dd185
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
38 lines (27 sloc) 897 Bytes
#ifndef __SIMPLE_UNIT_TEST_H
#define __SIMPLE_UNIT_TEST_H
#include <stdio.h>
#include <stdlib.h>
#define CHECK(val) if (val) { printf("Line number %d\n", __LINE__); return 1; }
#define KNRM "\x1B[0m"
#define KRED "\x1B[31m"
#define KGRN "\x1B[32m"
#define KYEL "\x1B[33m"
#define KBLU "\x1B[34m"
#define KMAG "\x1B[35m"
#define KCYN "\x1B[36m"
#define KWHT "\x1B[37m"
typedef int (*TestProcedure)(void);
/* Run a test with the given name and procedure. */
void run_test(const char* test_name, TestProcedure procedure);
/* Assert that two integers are equal. */
int assert_equal_int(int actual, int expected);
/* Assert that a value is true. */
int assert_true(int val);
/* Assert that a value is false. */
int assert_false(int val);
/* Assert that a pointer is null. */
int assert_null(void* ptr);
/* Assert that a pointer is not null. */
int assert_not_null(void* ptr);
#endif