示例#1
0
static void
test_fen_basic(void)
{
	struct position *position;
	struct position *next;
	move move;
	char str[FEN_BUFFER_LENGTH + MOVE_STR_BUFFER_LENGTH];
	static const char *empty_fen = "8/8/8/8/8/8/8/8 w - - 0 1";
	unsigned hm, fm;
	int ep_index;
	enum player turn;

	position = position_allocate();
	next = position_allocate();
	assert(position_print_fen_full(position, str, 0, 1, 0, white)
	    == str + strlen(empty_fen));
	assert(strcmp(empty_fen, str) == 0);
	assert(NULL != position_read_fen_full(position, start_position_fen,
	    &ep_index, &fm, &hm, &turn));
	assert(ep_index == 0);
	assert(hm == 0 && fm == 1 && turn == white);
	assert(position_print_fen_full(position, str, 0, 1, 0, white)
	    == str + strlen(start_position_fen));
	assert(strcmp(str, start_position_fen) == 0);
	move = create_move_t(str_to_index("e2", white),
	    str_to_index("e4", white),
	    mt_pawn_double_push, pawn, 0, false);
	setup_registers();
	make_move(next, position, move);
	assert(position_piece_at(next, str_to_index("e2", black)) == nonpiece);
	assert(position_piece_at(next, str_to_index("e4", black)) == pawn);
	position_destroy(position);
	position_destroy(next);
}
示例#2
0
void
run_tests(void)
{
	const struct game *g = parse_setboard_from_arg_file();

	setup_registers();
	test_tree_walk(game_current_position(g), 4);
}
static int tvga8900_interlaced(int mode)
{
    const unsigned char *regs;

    setup_registers();
    regs = LOOKUPMODE(tvga_modes, mode);
    if (regs == NULL || regs == DISABLE_MODE)
	return 0;
    return tvga8900_nonint == 0;
}
示例#4
0
文件: fname_modif.c 项目: jubalh/vifm
SETUP()
{
	setup_lwin();
	setup_rwin();

	curr_view = &lwin;
	other_view = &rwin;

	strcpy(cfg.home_dir, "/rwin/");

	setup_registers();
}
示例#5
0
static char*
print_san_check(const struct position *pos, move m, char *str)
{
	struct position child;
	setup_registers();
	make_move(&child, pos, m);
	if (is_in_check(&child)) {
		move moves[MOVE_ARRAY_LENGTH];
		if (gen_moves(&child, moves) == 0)
			*str++ = '#';
		else
			*str++ = '+';
	}

	return str;
}
示例#6
0
//--------------------------------------------------------------------------
// Initialize PPC debugger plugin
static bool init_plugin(void)
{
    if (ph.id != PLFM_PPC)
        return false;

    setup_registers();

    for (int k = 0; k < custom_format_count; ++k)
    {
        int dfid = register_custom_data_format(0, &custom_formats[k]);
        if (dfid < 0)
            msg("---: %d - Could not register custom format: %s - %lld bytes - %d wide\n", (uint32)k, custom_formats[k].name, (uint64)custom_formats[k].value_size, (uint32)custom_formats[k].text_width);
        else
            msg("---: %d - Registered custom format: %s - %lld bytes - %d wide\n", (uint32)k, custom_formats[k].name, (uint64)custom_formats[k].value_size, (uint32)custom_formats[k].text_width);

        custom_formats[k].ud = (void*)dfid;
    }

    intvec_t dts;
    int dt_count = get_custom_data_types(&dts);
    for (int i = 0; i < dt_count; ++i)
    {
        const data_type_t* t = get_custom_data_type(dts[i]);
        msg("%d - Type: %s - %lld bytes\n", (uint32)i, t->name, (uint64)t->value_size);
    }

    intvec_t dfs;
    int df_count = get_custom_data_formats(&dfs, 0);
    for (int j = 0; j < df_count; ++j)
    {
        const data_format_t* f = get_custom_data_format(0, dfs[j]);
        msg("---: %d - Format: %s - %lld bytes - %d wide\n", (uint32)j, f->name, (uint64)f->value_size, (uint32)f->text_width);
    }

    return true;
}