Esempio n. 1
0
void fixed_size_log_tests()
{
    TBEGIN( "Fixed size log tests" );

    cl::fixed_size_log log( 35 );
    TTEST( log.size() == 0 );
    TTEST( log.empty() );

    #define SIXTEEN_CHAR_STRING "A 16 byte entry\n"
    #define EIGHT_CHAR_STRING "8 bytes\n"
    #define HUGE_CHAR_STRING "This is a long char string intended to be too long to log in the fixed size log"

    log.insert( SIXTEEN_CHAR_STRING );
    TTEST( log.size() == 1 );
    TTEST( ! log.empty() );
    TTEST( log.get() == SIXTEEN_CHAR_STRING );

    log.insert( EIGHT_CHAR_STRING );
    TTEST( log.size() == 2 );
    TTEST( log.get() == SIXTEEN_CHAR_STRING EIGHT_CHAR_STRING );

    // This will cause log to over fill and the string shouldn't be added
    log.insert( HUGE_CHAR_STRING );
    TTEST( log.size() == 3 );
    TTEST( log.get() == SIXTEEN_CHAR_STRING EIGHT_CHAR_STRING );

    // This would fit in the space we've got left in the log, but because
    // the previous one didn't fit, this one shouldn't be looged either
    log.insert( EIGHT_CHAR_STRING );
    TTEST( log.size() == 4 );
    TTEST( log.get() == SIXTEEN_CHAR_STRING EIGHT_CHAR_STRING );
}
Esempio n. 2
0
void todo_tests()
{
    TBEGIN( "todo tests" );

    TTODO( "Master line counting" );
    TTODOX( 1 == 0 );
    TTODO( "Another test" );
    TTODOXN( 2, 1 == 0 );
}
Esempio n. 3
0
File: utils.c Progetto: Julow/lem_in
int				room_index(t_parser *parser, t_sub name)
{
	t_room			*it;
	t_room			*end;

	it = TBEGIN(t_room, parser->rooms) - 1;
	end = TEND(t_room, parser->rooms);
	while (++it < end)
		if (it->name_len == name.length
			&& ft_memcmp(it->name, name.str, name.length) == 0)
			return (it->id);
	return (-1);
}