Пример #1
0
int main(int argc, char *argv[])
{
    struct Set *set = constructSet();
    
    runTests(set);
    SetClose(set);     
    return 0;
}
Пример #2
0
void die(const char *message, struct Set *set)
{
    if(errno) {
        perror(message);
    } else {
        printf("ERROR: %s\n", message);
    }
    SetClose(set);
    exit(1);
}
Пример #3
0
void testEmpty()
{ 
    struct Set *set = constructSet();
    
    testTrue(empty(set) == true, "New set is empty");
    add(set, 123);

    testTrue(empty(set) == false, "Non empty set is not empty");

    SetClose(set);
}
Пример #4
0
void testSize()
{
    struct Set *set = constructSet();

    testTrue(size(set) == 0,  "New set is size 0");

    add(set, 1);
    testTrue(size(set) == 1,  "New set add one is size 1");

    rm(set, 1);
    testTrue(size(set) == 0,  "Old set rm one is size 0");

    SetClose(set);
}
Пример #5
0
BOOL CGate::InitSetProperty(CServerRegion::tagGateProperty *p)
{
	SetIndex(p->lIndex);//编号
	CShape::SetPosXY( (float)(p->lxPos + 0.5),(float)(p->lyPos + 0.5) );
	SetDir(p->lDir);//方向
	CShape::SetState(p->wOpenState);//打开状态
	CShape::SetAction(p->wOpenState);//动作
	SetAttackScp(p->strAttack);//受攻击脚本
	
	SetOpen(p->strOpen);//打开脚本
	SetClose(p->strClose);//关闭脚本
	SetDestoryScp(p->strDestory);//损毁脚本	
	SetRefreshScp(p->strRefresh);//重刷脚本
	return TRUE;
}
Пример #6
0
void testFullAndGrow()
{
    struct Set *set = constructSet();
    int i = 0;

    for (i = 0; i < STARTING_SET_SIZE * 3; i++) {
        add(set, i);
    }

    printf("%i %i %i\n", full(set), set->capacity, set->count);
    
    testTrue(set->count == 30, "added 30 elements");
    
    //rm(set, 29);
    for (i = 0; i < STARTING_SET_SIZE * 3; i++) {
        rm(set, i);
    }
    printf("%i %i %i\n", full(set), set->capacity, set->count);
    
    testTrue(set->count == 0, "removed 30 elements");
    
    SetClose(set);
}