int TestMain () {
    if( MinThread<0 ) {
        REPORT("ERROR: must use at least one thread\n");
        exit(1);
    }
    if( MaxThread<2 ) MaxThread=2;

    // Do serial tests
    TestTypes();
    TestCopy();
    TestRehash();
    TestAssignment();
    TestIteratorsAndRanges();
#if TBB_USE_EXCEPTIONS
    TestExceptions();
#endif /* TBB_USE_EXCEPTIONS */

    // Do concurrency tests.
    for( int nthread=MinThread; nthread<=MaxThread; ++nthread ) {
        tbb::task_scheduler_init init( nthread );
        TestInsertFindErase( nthread );
        TestConcurrency( nthread );
    }
    // check linking
    if(bad_hashing) { //should be false
        tbb::internal::runtime_warning("none\nERROR: it must not be executed");
    }

    return Harness::Done;
}
Exemplo n.º 2
0
int
main(int argc, char** argv)
{
  if (!ParseArgs(argc, argv))
    return 0;

  plan_tests(52);

  Waypoints waypoints;
  GeoPoint center(Angle::Degrees(51.4), Angle::Degrees(7.85));

  // AddSpiralWaypoints creates 151 waypoints from
  // 0km to 150km distance in 1km steps
  AddSpiralWaypoints(waypoints, center);

  ok1(!waypoints.IsEmpty());
  ok1(waypoints.size() == 151);

  TestLookups(waypoints, center);
  TestNamePrefixVisitor(waypoints);
  TestRangeVisitor(waypoints, center);
  TestGetNearest(waypoints, center);
  TestIterator(waypoints);

  ok(TestCopy(waypoints), "waypoint copy", 0);
  ok(TestErase(waypoints, 3), "waypoint erase", 0);
  ok(TestReplace(waypoints, 4), "waypoint replace", 0);

  // test clear
  waypoints.Clear();
  ok1(waypoints.IsEmpty());
  ok1(waypoints.size() == 0);

  return exit_status();
}
Exemplo n.º 3
0
int main(int argc, char **argv)
{
  plan_tests(60);

  TestBasic();
  TestCopy();

  return exit_status();
}
Exemplo n.º 4
0
int main(int argc, char** argv)
{
    ScopedXPCOM xpcom("nsLocalFile");
    if (xpcom.failed())
        return 1;

    nsCOMPtr<nsIFile> base;
    nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(base));
    if (!VerifyResult(rv, "Getting temp directory"))
        return 1;
    rv = base->AppendNative(nsDependentCString("mozfiletests"));
    if (!VerifyResult(rv, "Appending mozfiletests to temp directory name"))
        return 1;
    // Remove the directory in case tests failed and left it behind.
    // don't check result since it might not be there
    base->Remove(true);

    // Now create the working directory we're going to use
    rv = base->Create(nsIFile::DIRECTORY_TYPE, 0700);
    if (!VerifyResult(rv, "Creating temp directory"))
        return 1;
    // Now we can safely normalize the path
    rv = base->Normalize();
    if (!VerifyResult(rv, "Normalizing temp directory name"))
        return 1;

    // Initialize subdir object for later use
    nsCOMPtr<nsIFile> subdir = NewFile(base);
    if (!subdir)
        return 1;
    rv = subdir->AppendNative(nsDependentCString("subdir"));
    if (!VerifyResult(rv, "Appending 'subdir' to test dir name"))
        return 1;

    passed("Setup");

    // Test path parsing
    if (TestInvalidFileName(base, "a/b")) {
        passed("AppendNative with invalid file name");
    }
    if (TestParent(base, subdir)) {
        passed("GetParent");
    }

    // Test file creation
    if (TestCreate(base, "file.txt", nsIFile::NORMAL_FILE_TYPE, 0600)) {
        passed("Create file");
    }
    if (TestRemove(base, "file.txt", false)) {
        passed("Remove file");
    }

    // Test directory creation
    if (TestCreate(base, "subdir", nsIFile::DIRECTORY_TYPE, 0700)) {
        passed("Create directory");
    }

    // Test move and copy in the base directory
    if (TestCreate(base, "file.txt", nsIFile::NORMAL_FILE_TYPE, 0600) &&
        TestMove(base, base, "file.txt", "file2.txt")) {
        passed("MoveTo rename file");
    }
    if (TestCopy(base, base, "file2.txt", "file3.txt")) {
        passed("CopyTo copy file");
    }
    // Test moving across directories
    if (TestMove(base, subdir, "file2.txt", "file2.txt")) {
        passed("MoveTo move file");
    }
    // Test moving across directories and renaming at the same time
    if (TestMove(subdir, base, "file2.txt", "file4.txt")) {
        passed("MoveTo move and rename file");
    }
    // Test copying across directoreis
    if (TestCopy(base, subdir, "file4.txt", "file5.txt")) {
        passed("CopyTo copy file across directories");
    }

    // Run normalization tests while the directory exists
    if (TestNormalizeNativePath(base, subdir)) {
        passed("Normalize with native paths");
    }

    // Test recursive directory removal
    if (TestRemove(base, "subdir", true)) {
        passed("Remove directory");
    }

    if (TestCreateUnique(base, "foo", nsIFile::NORMAL_FILE_TYPE, 0600) &&
        TestCreateUnique(base, "foo", nsIFile::NORMAL_FILE_TYPE, 0600)) {
        passed("CreateUnique file");
    }
    if (TestCreateUnique(base, "bar.xx", nsIFile::DIRECTORY_TYPE, 0700) &&
        TestCreateUnique(base, "bar.xx", nsIFile::DIRECTORY_TYPE, 0700)) {
        passed("CreateUnique directory");
    }

    if (TestDeleteOnClose(base, "file7.txt", PR_RDWR | PR_CREATE_FILE, 0600)) {
        passed("OpenNSPRFileDesc DELETE_ON_CLOSE");
    }

    gFunction = "main";
    // Clean up temporary stuff
    rv = base->Remove(true);
    VerifyResult(rv, "Cleaning up temp directory");

    return gFailCount > 0;
}
Exemplo n.º 5
0
GLDEF_C TInt E32Main()
//
// Test the TDes type.
//
    {
	test.Title();
//
	TInt startAvail,temp;
	startAvail=User::Available(temp);
//
	test.Start(_L("Assigning TPtr's"));
	testAssignTPtr();
//
	test.Next(_L("Locate reverse on empty TPtr"));
	testTPtrLocateReverse();
//
	test.Next(_L("class TBuf<0x40>"));
	TestTDes<TBuf<0x40>,TText,TUint, TPtrC> jj;
	jj.test_TBuf();
	jj.testHeapSpace(startAvail);
	test.End();
//
	test.Next(_L("class TBuf8<0x40>"));
	TestTDes<TBuf8<0x40>,TUint8,TUint8, TPtrC8> ii;
	ii.test_TBuf();
	ii.testHeapSpace(startAvail);
	test.End();
//
	test.Next(_L("class TBuf16<0x40>"));
	TestTDes<TBuf16<0x40>,TUint16,TUint16, TPtrC16> hh;
	hh.test_TBuf();
	hh.testHeapSpace(startAvail);
	test.End();	
//
	test.Next(_L("class TPtrC"));
	TestTDes<TPtrC,TText,TUint, TPtrC> dd;
	dd.test_TPtrC();
	dd.testHeapSpace(startAvail);
	test.End();
//
	test.Next(_L("class TPtrC8"));
	TestTDes<TPtrC8,TUint8,TUint8, TPtrC8> cc;
	cc.test_TPtrC();
	cc.testHeapSpace(startAvail);
	test.End();
//
	test.Next(_L("class TPtrC16"));
	TestTDes<TPtrC16,TUint16,TUint16, TPtrC16> bb;
	bb.test_TPtrC();
	bb.testHeapSpace(startAvail);
	test.End();
//
	test.Next(_L("class TPtr"));
	TestTDes<TPtr,TText,TUint, TPtrC> gg;
	gg.test_TPtr();
	gg.testHeapSpace(startAvail);
	test.Next(_L("Copy constructor"));
	TestCopy();
	test.End();	
//
	test.Next(_L("class TPtr8"));
	TestTDes<TPtr8,TUint8,TUint8, TPtrC8> ff;
	ff.test_TPtr();
	ff.testHeapSpace(startAvail);
	test.Next(_L("Copy constructor"));
	TestCopy8();
	test.End();	
//
	test.Next(_L("class TPtr16"));
	TestTDes<TPtr16,TUint16,TUint16, TPtrC16> ee;
	ee.test_TPtr();
	ee.testHeapSpace(startAvail);
	test.Next(_L("Copy constructor"));
	TestCopy16();
	test.End();	
//
	test.Next(_L("class TBufC"));
	TestTDes<TBufC<0x40>, TText, TUint16, TPtrC> kk;
	kk.test_TBufC();
	kk.testHeapSpace(startAvail);
	test.End();
//
	test.Next(_L("class TBufC8"));
	TestTDes<TBufC8<0x40>, TUint8, TUint8, TPtrC8> ll;
	ll.test_TBufC();
	ll.testHeapSpace(startAvail);
	test.End();
//
	test.Next(_L("class TBufC16"));
	TestTDes<TBufC16<0x40>, TUint16, TUint16, TPtrC16> mm;
	mm.test_TBufC();
	mm.testHeapSpace(startAvail);
	test.End();
//
	test.Next(_L("class HBufC"));
	TestTDes<HBufC, TText, TUint, TPtrC>  nn;
	nn.test_HBufC();
	nn.testHeapSpace(startAvail);
	test.End();
//
	test.Next(_L("class HBufC8"));
	TestTDes<HBufC8, TUint8, TUint8, TPtrC8>  oo;
	oo.test_HBufC();
	oo.testHeapSpace(startAvail);
	test.End();

	test.Next(_L("Test Unicode to Ascii stuff"));
	Test16To8();
//
	test.Next(_L("class HBufC16"));
	TestTDes<HBufC16, TUint16, TUint16, TPtrC16>  pp;
	pp.test_HBufC();
	pp.testHeapSpace(startAvail);
	test.End();
//
	testLiteral();
//
	test.Next(_L("class TBuf returning TPtr"));
	TestTDes<TBuf<0x40>, TText, TUint, TPtr> qq;
	qq.test_TBufReturningModifiable();
	test.End();

	test.Next(_L("class TBuf8 returning TPtr8"));
	TestTDes<TBuf8<0x40>, TText8, TUint8, TPtr8> rr;
	rr.test_TBufReturningModifiable();
	test.End();

	test.Next(_L("class TBuf16 returning TPtr16"));
	TestTDes<TBuf16<0x40>, TText16, TUint16, TPtr16> ss;
	ss.test_TBufReturningModifiable();
	test.End();

	test.Next(_L("class TPtr returning TPtr"));
	TestTDes<TPtr, TText, TUint, TPtr> tt;
	tt.test_TPtrReturningModifiable();
	test.End();

	test.Next(_L("class TPtr8 returning TPtr8"));
	TestTDes<TPtr8, TText8, TUint8, TPtr8> uu;
	uu.test_TPtrReturningModifiable();
	test.End();

	test.Next(_L("class TPtr16 returning TPtr16"));
	TestTDes<TPtr16, TText16, TUint16, TPtr16> vv;
	vv.test_TPtrReturningModifiable();
	test.End();

	testSurrogateAwareInterfaces();
	test.End();

	return(KErrNone);
    }