/*
* VAS_EBOOT -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc.
*
* VAS_EBOOT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VAS_EBOOT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VAS_EBOOT. If not, see .
*/
#ifndef VAS_EBOOT_TEST_HEADER
#define VAS_EBOOT_TEST_HEADER
#include
#include
#include
#include
#include
#include
#include
#ifdef __cplusplus
extern "C" {
#endif
struct VasEBoot_test
{
/* The next test. */
struct VasEBoot_test *next;
struct VasEBoot_test **prev;
/* The test name. */
char *name;
/* The test main function. */
void (*main) (void);
};
typedef struct VasEBoot_test *VasEBoot_test_t;
extern VasEBoot_test_t VasEBoot_test_list;
void VasEBoot_test_register (const char *name, void (*test) (void));
void VasEBoot_test_unregister (const char *name);
/* Execute a test and print results. */
int VasEBoot_test_run (VasEBoot_test_t test);
/* Test `cond' for nonzero; log failure otherwise. */
void VasEBoot_test_nonzero (int cond, const char *file,
const char *func, VasEBoot_uint32_t line,
const char *fmt, ...)
__attribute__ ((format (GNU_PRINTF, 5, 6)));
/* Macro to fill in location details and an optional error message. */
void VasEBoot_test_assert_helper (int cond, const char *file,
const char *func, VasEBoot_uint32_t line,
const char *condstr, const char *fmt, ...)
__attribute__ ((format (GNU_PRINTF, 6, 7)));
#define VasEBoot_test_assert(cond, ...) \
VasEBoot_test_assert_helper(cond, VAS_EBOOT_FILE, __FUNCTION__, __LINE__, \
#cond, ## __VA_ARGS__);
void VasEBoot_unit_test_init (void);
void VasEBoot_unit_test_fini (void);
/* Macro to define a unit test. */
#define VAS_EBOOT_UNIT_TEST(name, funp) \
void VasEBoot_unit_test_init (void) \
{ \
VasEBoot_test_register (name, funp); \
} \
\
void VasEBoot_unit_test_fini (void) \
{ \
VasEBoot_test_unregister (name); \
}
/* Macro to define a functional test. */
#define VAS_EBOOT_FUNCTIONAL_TEST(name, funp) \
VAS_EBOOT_MOD_INIT(name) \
{ \
VasEBoot_test_register (#name, funp); \
} \
\
VAS_EBOOT_MOD_FINI(name) \
{ \
VasEBoot_test_unregister (#name); \
}
void
VasEBoot_video_checksum (const char *basename_in);
void
VasEBoot_video_checksum_end (void);
void
VasEBoot_terminal_input_fake_sequence (int *seq_in, int nseq_in);
void
VasEBoot_terminal_input_fake_sequence_end (void);
const char *
VasEBoot_video_checksum_get_modename (void);
#define VAS_EBOOT_TEST_VIDEO_SMALL_N_MODES 7
#define VAS_EBOOT_TEST_VIDEO_ALL_N_MODES 31
extern struct VasEBoot_video_mode_info VasEBoot_test_video_modes[VAS_EBOOT_TEST_VIDEO_ALL_N_MODES];
int
VasEBoot_test_use_gfxterm (void);
void VasEBoot_test_use_gfxterm_end (void);
#ifdef __cplusplus
}
#endif
#endif /* ! VAS_EBOOT_TEST_HEADER */