Permalink
Cannot retrieve contributors at this time
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?
queue/simple_unit_test/simple_unit_test.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
38 lines (27 sloc)
897 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |