Пример #1
0
int main(int argc, char *argv[])
{
    testArray();
    testPlugin();
    testList();
    return 0;
    testByteArray();
    testHash();
    testImage();
    testIO();
    testMap();
    testString();
    testStringList();
    testStruct();
    testThreads();
    testVariant1();
    testVariant2();
    testVariant3();
    testVector();
    testVectorOfList();

    testObject(argc, argv);

    QColor color(255,128,10);
    QFont font;

    while(true)
        ;

    return 0;
}
Пример #2
0
int main(int argc, char *argv[])
{
    xhn::thread_ptr t = VNEW xhn::thread();
    while(!t->is_running()) {}
    volatile int completed = 0;

    xhn::Lambda<xhn::thread::TaskStatus()> testAtomicOpsProc([&completed](){
        testAtomicOps();
        printf("passed test atomic ops!\n");
        completed += 1;
        return xhn::thread::Completed;
    });

    xhn::Lambda<xhn::thread::TaskStatus()> testVectorProc([&completed](){
        testVector();
        printf("passed test vector!\n");
        completed += 1;
        return xhn::thread::Completed;
    });

    xhn::Lambda<xhn::thread::TaskStatus()> testWeakPtrProc([&completed](){
        testWeakPtr();
        printf("passed test weak ptr!\n");
        completed += 1;
        return xhn::thread::Completed;
    });

    t->add_lambda_task(testAtomicOpsProc);
    t->add_lambda_task(testVectorProc);
    t->add_lambda_task(testWeakPtrProc);

    while (completed < 3) {}
    return 0;
}
Пример #3
0
void startTest() {
	TCHAR logFileName[1024];

	getLogFilename(logFileName);
	testLogFile = _tfopen(logFileName, _T("w"));
	if (!testLogFile)
		return;

	int pointTestErr = testPoint();
	logHLine();
	int vectorTestErr = testVector();
	logHLine();
	int lineTestErr = testLine();
	logHLine();
	int planeTestErr = testPlane();
	logHLine();
	int triangleTestErr = testTriangle();
	logHLine();
	int basisTestErr = testBasis();
	logHLine();
	int matrixTestErr = testMatrix();


	fclose(testLogFile);
	testLogFile = NULL;
}
Пример #4
0
int main(int argc, char *argv[])
{
    testArray();
    testVector();
    testVec2f();
    testVec3f();
    testMatrix33f();
}
Пример #5
0
int main(int argc, char** argv){
	testPair();
	testVector();
	testList();
	testHash();
	testTable();
	return 0;
}
Пример #6
0
void main()
{
    try
    {
        testVector();
        testVectorWithTypedef();
        testMap();

        std::cout << "\n\nFinished\n\n";
    }
    catch (std::exception & e)
    {
        std::cout << "\n\nException - " << e.what() << "\n\n";
    }
    catch (...)
    {
        std::cout << "\n\nUnhandled exception\n\n";
    }
}
Пример #7
0
int main(void)
{
#if 1
	int errors=0;
	errors += testBloomFilter();
    testStringCollection();
	errors += testVector();
	testList();
	testBinarySearchTree();
	testStringCollection();
	TestDictionary();
	TestBitstring();
	testScapegoatTree();
	testStreamBuffers();
	/*RedBlackTree * rb = newRedBlackTree(20,5);*/
	/*rb->VTable->Finalize(rb);*/
	return errors;
#else

#endif
}
pair< bool , Word > FreeMetabelianGroupAlgorithms::conjugate( int N , Word w1 , Word w2 )
{
    // A. Compute the tails for w1 and w2
    vector< int > T1 = getTail( N , w1 );
    vector< int > T2 = getTail( N , w2 );

    // B. If tails are different then the answer is no
    if( T1!=T2 )
        return pair< bool , Word >( false , Word() );

    //----------------------------------------------------------
    // C. If the tails are trivial
    if( T1==vector< int >( N, 0 ) ) {
        // 1. Compute the edge-maps and check if they are of the same size
        map< vector< int > , int > EM1 = dropTrivialEdgesInMap( getEdgeMap( N , w1 ) );
        map< vector< int > , int > EM2 = dropTrivialEdgesInMap( getEdgeMap( N , w2 ) );
        if( EM1.size( )!=EM2.size( ) )
            return pair< bool , Word >( false , Word() );

        // 2. Check if the elements are trivial
        if( EM1.size( )==0 )
            return pair< bool , Word >( true , Word() );

        // 3. Determine the required shift
        pair< vector< int > , int > C1 = *EM1.begin( );
        pair< vector< int > , int > C2 = *EM2.begin( );
        vector< int > S( N , 0 );
        for( int i=0 ; i<N ; ++i )
            S[i] = C2.first[i]-C1.first[i];
        EM1 = shiftEdgeMap( N , S , EM1 );
        if( EM1==EM2)
            return pair< bool , Word >( true , -getTailWord( N , S ) );
        else
            return pair< bool , Word >( false , Word() );
    }

    //----------------------------------------------------------
    // D. Move the space so that x1-component is positive and others are non-negative
    vector< Word > Images(N);
    for( int j=0 ; j<N ; ++j )
        Images[j] = Word( j+1 );
    if( T1[0]==0 ) {

        // 1. Find the first non-trivial component xi and swap(x1,xi)
        for( int i=1 ; i<N ; ++i ) {
            if( T1[i]!=0 ) {
                Images[0] = Word( i+1 );
                Images[i] = Word( 1 );
                swap( T1[0] , T1[i] );
                break;
            }
        }
    }
    Map M1( N , N , Images );
    w1 = M1.imageOf( w1 );
    w2 = M1.imageOf( w2 );

    //----------------------------------------------------------
    // E. Make negative components positive
    vector< Word > Images2( N );
    for( int i=0 ; i<N ; ++i ) {
        if( T1[i]>=0 )
            Images2[i] = Word(+i+1);
        else
            Images2[i] = Word(-i-1);
        T1[i] = abs(T1[i]);
    }
    Map M2( N , N , Images2 );
    w1 = M2.imageOf( w1 );
    w2 = M2.imageOf( w2 );

    //----------------------------------------------------------
    // F. Compute the strip-forms for elements
    map< vector< int > , int > EM1 = dropTrivialEdgesInMap( modEdgeMap( N , T1 , getEdgeMap( N , w1 ) ) );
    map< vector< int > , int > EM2 = dropTrivialEdgesInMap( modEdgeMap( N , T1 , getEdgeMap( N , w2 ) ) );

    //----------------------------------------------------------
    // G. For all possible x1-transformations:
    int u1 = T1[0];
    for( int i=0 ; i<u1 ; ++i ) {

        // 1. Apply an x1-shift
        EM1 = x1shiftEdgeMap( N , T1 , EM1 );

        // 2. Suggest a tail-conjugator
        pair< bool , vector< int > > r = suggestTailConjugator( N , EM1 , EM2 );
        r.second[0] += i+1;

        // 3. Test a tail conjugator
        if( r.first ) {
            if( testVector( N , T1 , w1 , w2 , r.second ) ) {
                // Find an actual conjugator
                Word C = getTailWord( N , r.second );
                Word D = getLoopConjugator( N , T1 , w1 , -C*w2*C );
                return pair< bool , Word >( true , M1.imageOf( M2.imageOf( D*-C ) ) );
            }
        }
    }

    return pair< bool , Word >( false , Word() );
}
Пример #9
0
int main(int, char**)
{
	testVector();
	testMatrix();
	testCrsMatrix();
}