void test_group<test_data>::object::test<2>() {
	set_test_name("Test adding valid key-pointers");

	node.set_leftmost_pointer(0);
	node.insert_key_in_order(100, 1);
	node.insert_key_in_order(200, 2);
	node.insert_key_in_order(50, 3);

	ensure_equals(node.get_left_pointer_of(50), 0);
	ensure_equals(node.get_right_pointer_of(50), 3);
	ensure_equals(node.get_left_pointer_of(100), 3);
	ensure_equals(node.get_right_pointer_of(100), 1);
	ensure_equals(node.get_left_pointer_of(200), 1);
	ensure_equals(node.get_right_pointer_of(200), 2);
}
void test_group<test_data>::object::test<3>() {
	set_test_name("Test adding duplicate key-pointers");

	node.insert_key_in_order(50, 1);
	node.insert_key_in_order(100, 2);
	node.insert_key_in_order(150, 3);
	node.insert_key_in_order(250, 4);

	try {
		node.insert_key_in_order(150, 5);
		fail("Failed to detect duplicate key-pointer");
	} catch (duplicate &o) {

	}
}
Beispiel #3
0
 void object::test<4>()
 {
    set_test_name("Javascript Test 3: window.setInterval()");
    
    canvas->startWithCode("window.setInterval(function() { console.log(\"Hello, World!\"); });");
    ensure(canvas->lastLogEntry() == "");
    
    canvas->paint(0);
    canvas->paint(0);
    
    // After we have painter two times, we should have two "Hello, World!" messages in the history
    ensure(canvas->lastLogEntry() == "Hello, World!");
    ensure(canvas->lastLogEntry() == "Hello, World!");
    ensure(canvas->lastLogEntry() == "");
 }
    void object::test<5>()
    {
        set_test_name("Test LLMediaEntry::asLLSD() -> LLMediaEntry::fromLLSD()");
        LLMediaEntry entry1, entry2;
		// Add a whitelist to entry2
		std::vector<std::string> whitelist;
		whitelist.push_back("*.example.com");
        entry2.setWhiteList(whitelist);
		// Render entry1 (which has no whitelist) as an LLSD
        LLSD sd;
		entry1.asLLSD(sd);
		// "read" that LLSD into entry 2
		entry2.fromLLSD(sd);
        ensure_llsd_equals(get_test_name() + " failed", defaultMediaEntryLLSD, entry2.asLLSD());
    }
    void AsString_object::test<5>()
    {
        set_test_name("Equality test 3");

        AsString_ref str1 = ASL("This is string");
        AsString_ref str2 = AS_NULL;
        AsString_ref str3 = AS_NULL;

        bool succeed = true;
        succeed = succeed && str1 != str2;
        succeed = succeed && str2 != str1;
        succeed = succeed && str2 == str3;

        ensure(succeed);
    }
Beispiel #6
0
void object::test<2>()
{
    set_test_name("checks attempt to run test/tests in unexistent group");

    try
    {
        tr.run_tests("unexistent");
        fail("expected no_such_group");
    }
    catch (const no_such_group&)
    {
        // as expected
    }

    try
    {
        test_result r;
        tr.run_test("unexistent", 1, r);
        fail("expected tut::no_such_group");
    }
    catch (const no_such_group& )
    {
        // as expected
    }

    try
    {
        tr.set_callback(&callback);
        tr.run_tests("unexistent");
        fail("expected tut::no_such_group");
    }
    catch (const no_such_group&)
    {
        // as expected
    }

    try
    {
        tr.set_callback(&callback);
        test_result r;
        tr.run_test("unexistent", 1, r);
        fail("expected tut::no_such_group");
    }
    catch (const no_such_group&)
    {
        // as expected
    }
}
 void object::test<11>()
 {
     set_test_name("Test to make sure both setWhiteList() functions behave the same");
     
     // Test a valid list
     std::vector<std::string> whitelist, empty;
     LLSD whitelist_llsd;
     whitelist.push_back(std::string(URL_OK));
     whitelist_llsd.append(std::string(URL_OK));
     LLMediaEntry entry1, entry2;
     ensure(get_test_name() + " setWhiteList(s) don't match",
            entry1.setWhiteList(whitelist) == LSL_STATUS_OK &&
            entry2.setWhiteList(whitelist_llsd)== LSL_STATUS_OK );
     ensure(get_test_name() + " failed", 
            entry1.getWhiteList() == entry2.getWhiteList());
 }
Beispiel #8
0
    void fixture::test<1>() 
    {
        set_test_name("detach_state");

        pthreadxx::thread_attribute attribute;
        ensure_equals("default state", attribute.detach_state(),
                PTHREAD_CREATE_JOINABLE);

        attribute.detach_state(PTHREAD_CREATE_DETACHED);
        ensure_equals("set detached state", attribute.detach_state(),
                PTHREAD_CREATE_DETACHED);

        attribute.detach_state(PTHREAD_CREATE_JOINABLE);
        ensure_equals("set joinable state", attribute.detach_state(),
                PTHREAD_CREATE_JOINABLE);
    }
    void AsString_object::test<13>()
    {
        set_test_name("replace test");

        AsString_ref str1 = ASL("This is string");

        bool succeed = true;
        succeed = succeed && str1->replace(ASL(" is "), ASL("-")) == ASL("This-string");
        succeed = succeed && str1->replace(ASL(" is "), ASL(" is a long ")) == ASL("This is a long string");
        succeed = succeed && str1->replace(ASL(" is string"), ASL("")) == ASL("This");
        succeed = succeed && str1->replace(ASL("This is "), ASL("")) == ASL("string");
        succeed = succeed && str1->replace(ASL("This is string"), ASL("")) == ASL("");
        succeed = succeed && str1->replace(ASL("This is string!"), ASL("")) == ASL("This is string");
        succeed = succeed && str1->replace(ASL("is string!"), ASL("")) == ASL("This is string");
        ensure(succeed);
    }
Beispiel #10
0
void TestRegistry::test<1>()
{
    set_test_name("RotateAboutX (3x3 matrix)");

    a3f[0] = 2.0f; a3f[3] = 5.0f; a3f[6] =  8.0f;
    a3f[1] = 3.0f; a3f[4] = 6.0f; a3f[7] =  9.0f;
    a3f[2] = 4.0f; a3f[5] = 7.0f; a3f[8] = 10.0f;
    
    degrees = 123.4f;
    radians = toRadians(degrees);
    c       = std::cos(radians);
    s       = std::sin(radians);

    jship::Hazmat::RotateAboutX(a3f, radians, b3f);
    
    DOUBLES_EQUAL(a3f[ 0],  2.0, 1e-5);
    DOUBLES_EQUAL(a3f[ 1],  3.0, 1e-5);
    DOUBLES_EQUAL(a3f[ 2],  4.0, 1e-5);
    DOUBLES_EQUAL(a3f[ 3],  5.0, 1e-5);
    DOUBLES_EQUAL(a3f[ 4],  6.0, 1e-5);
    DOUBLES_EQUAL(a3f[ 5],  7.0, 1e-5);
    DOUBLES_EQUAL(a3f[ 6],  8.0, 1e-5);
    DOUBLES_EQUAL(a3f[ 7],  9.0, 1e-5);
    DOUBLES_EQUAL(a3f[ 8], 10.0, 1e-5);
   
    DOUBLES_EQUAL(b3f[ 0],                  2.0f, 1e-5);
    DOUBLES_EQUAL(b3f[ 1],  3.0f * c -  4.0f * s, 1e-5);
    DOUBLES_EQUAL(b3f[ 2],  4.0f * c +  3.0f * s, 1e-5);
    DOUBLES_EQUAL(b3f[ 3],                  5.0f, 1e-5);
    DOUBLES_EQUAL(b3f[ 4],  6.0f * c -  7.0f * s, 1e-5);
    DOUBLES_EQUAL(b3f[ 5],  7.0f * c +  6.0f * s, 1e-5);
    DOUBLES_EQUAL(b3f[ 6],                  8.0f, 1e-5);
    DOUBLES_EQUAL(b3f[ 7],  9.0f * c - 10.0f * s, 1e-5);
    DOUBLES_EQUAL(b3f[ 8], 10.0f * c +  9.0f * s, 1e-5);
    
    jship::Hazmat::RotateAboutX(a3f, radians, a3f);
    
    DOUBLES_EQUAL(a3f[ 0],                  2.0f, 1e-5);
    DOUBLES_EQUAL(a3f[ 1],  3.0f * c -  4.0f * s, 1e-5);
    DOUBLES_EQUAL(a3f[ 2],  4.0f * c +  3.0f * s, 1e-5);
    DOUBLES_EQUAL(a3f[ 3],                  5.0f, 1e-5);
    DOUBLES_EQUAL(a3f[ 4],  6.0f * c -  7.0f * s, 1e-5);
    DOUBLES_EQUAL(a3f[ 5],  7.0f * c +  6.0f * s, 1e-5);
    DOUBLES_EQUAL(a3f[ 6],                  8.0f, 1e-5);
    DOUBLES_EQUAL(a3f[ 7],  9.0f * c - 10.0f * s, 1e-5);
    DOUBLES_EQUAL(a3f[ 8], 10.0f * c +  9.0f * s, 1e-5);
}
Beispiel #11
0
void object::test<3>()
{
    set_test_name("checks no_throw");

    try
    {
        ensure_NO_THROW( skip() );
        throw std::runtime_error("no_throw doesn't work");
    }
    catch (const failure& ex)
    {
        if (std::string(ex.what()).find("skip()") == std::string::npos )
        {
            fail("no_throw doesn't contain proper message");
        }
    }
}
Beispiel #12
0
void object::test<1>()
{
    set_test_name("checks throw");

    try
    {
        ensure_THROW( foo(), bar_exception );
        throw std::runtime_error("throw doesn't work");
    }
    catch (const failure& ex)
    {
        if (std::string(ex.what()).find("foo()") == std::string::npos )
        {
            fail("throw doesn't contain proper message");
        }
    }
}
Beispiel #13
0
void object::test<5>()
{
    set_test_name("checks throw std::exception");

    try
    {
        ensure_THROW( noop(), std::exception );
        fail("throw doesn't work");
    }
    catch (const failure& ex)
    {
        if (std::string(ex.what()).find("noop()") == std::string::npos )
        {
            fail("throw doesn't contain proper message");
        }
    }
}
	void processor_object_t::test<1>()
	{
		set_test_name("LLProcessorInfo regression test");

		LLProcessorInfo pi;
		F64 freq =  pi.getCPUFrequency();
		//bool sse =  pi.hasSSE();
		//bool sse2 = pi.hasSSE2();
		//bool alitvec = pi.hasAltivec();
		std::string family = pi.getCPUFamilyName();
		std::string brand =  pi.getCPUBrandName();
		//std::string steam =  pi.getCPUFeatureDescription();

		ensure_not_equals("Unknown Brand name", brand, "Unknown"); 
		ensure_not_equals("Unknown Family name", family, "Unknown"); 
		ensure("Reasonable CPU Frequency > 100 && < 10000", freq > 100 && freq < 10000);
	}
Beispiel #15
0
void object::test<1>() {
    static int frame = 0;

    set_test_name("Initialize network environment");
    elf::net_listen(0, "test_server", "localhost", 6670);
    elf::net_connect(0, "test_client", "localhost", 6670);

    while (true) {
        elf::net_proc();
        usleep(50000);
        if (++frame % 20 == 0) {
            putchar('.');
            fflush(stdout);
        }
    }
    ensure(true);
}
Beispiel #16
0
    void AsString_object::test<8>()
    {
        set_test_name("lastIndexOf test");

        AsString_ref str1 = ASL("This is string");        

        bool succeed = true;
        succeed = succeed && str1->lastIndexOf(ASL(" is ")) == 4;
        succeed = succeed && str1->lastIndexOf(ASL(" iz ")) == -1;
        succeed = succeed && str1->lastIndexOf(ASL(" string")) == 7;
        succeed = succeed && str1->lastIndexOf(ASL("This ")) == 0;
        succeed = succeed && str1->lastIndexOf(ASL("This "), 1) == -1;
        succeed = succeed && str1->lastIndexOf(ASL("is"), 2) == 2;
        succeed = succeed && str1->lastIndexOf(ASL("is"), 3) == 5;
        succeed = succeed && str1->lastIndexOf(ASL("stra"), 3) == -1;

        ensure(succeed);
    }
Beispiel #17
0
	void llprimitive_object_t::test<6>()
	{
		set_test_name("Test setVolume creation of new NOT-unique volume.");
		LLPrimitive primitive;
		LLVolumeParams params;
		
		// Make sure volume starts off null
		ensure(primitive.getVolume() == NULL);
		
		// Make sure we have no texture entries before setting the volume
		ensure_equals(primitive.getNumTEs(), 0);
		
		// Test that GEOMETRY has not been flagged as changed.
		ensure(!primitive.isChanged(LLXform::GEOMETRY));
		
		// Make sure setVolume returns true
		ensure(primitive.setVolume(params, 0, false) == TRUE);
		
		LLVolume* new_volume = primitive.getVolume();
		
		// make sure new volume was actually created
		ensure(new_volume != NULL);
		
		// Make sure that now that we've set the volume we have texture entries
		ensure_not_equals(primitive.getNumTEs(), 0);
		
		// Make sure that the number of texture entries equals the number of faces in the volume (should be 6)
		ensure_equals(new_volume->getNumFaces(), 6);
		ensure_equals(primitive.getNumTEs(), new_volume->getNumFaces());
		
		// Test that GEOMETRY has been flagged as changed.
		ensure(primitive.isChanged(LLXform::GEOMETRY));
		
		// Run it twice to make sure it doesn't create a different one if params are the same
		ensure(primitive.setVolume(params, 0, false) == FALSE);
		ensure(new_volume == primitive.getVolume());
		
		// Change the param definition and try setting it again.
		params.setRevolutions(4);
		ensure(primitive.setVolume(params, 0, false) == TRUE); 
		
		// Ensure that we now have a different volume
		ensure(new_volume != primitive.getVolume());
	}
Beispiel #18
0
void object::test<3>()
{
    set_test_name("function names");

    setCode(),
        "module Asia;",
        "_() -> void { }",
        " a() -> void { }",
        "  a15() -> void { }",
        "   _123135() -> void { }",
        "    aAa() -> void { }",
        "     _64_characters__________________________________________________() -> void { }";

    parse();
    
    ensure_success();
    ensure_equals("6 declarations", module->decls.size(), 6u);
    ensure("function", module->decls[0].type() == typeid(sl::cst::Function));
    ensure("function", module->decls[1].type() == typeid(sl::cst::Function));
    ensure("function", module->decls[2].type() == typeid(sl::cst::Function));
    ensure("function", module->decls[3].type() == typeid(sl::cst::Function));
    ensure("function", module->decls[4].type() == typeid(sl::cst::Function));
    ensure("function", module->decls[5].type() == typeid(sl::cst::Function));
    
    sl::cst::Function& f0 = boost::get<sl::cst::Function>(module->decls[0]);
    sl::cst::Function& f1 = boost::get<sl::cst::Function>(module->decls[1]);
    sl::cst::Function& f2 = boost::get<sl::cst::Function>(module->decls[2]);
    sl::cst::Function& f3 = boost::get<sl::cst::Function>(module->decls[3]);
    sl::cst::Function& f4 = boost::get<sl::cst::Function>(module->decls[4]);
    sl::cst::Function& f5 = boost::get<sl::cst::Function>(module->decls[5]);
    
    ensure("position 0", f0.name.pos == sl::FilePosition("", 2, 1));
    ensure_equals("name 0", f0.name.str, "_");
    ensure("position 1", f1.name.pos == sl::FilePosition("", 3, 2));
    ensure_equals("name 1", f1.name.str, "a");
    ensure("position 2", f2.name.pos == sl::FilePosition("", 4, 3));
    ensure_equals("name 2", f2.name.str, "a15");
    ensure("position 3", f3.name.pos == sl::FilePosition("", 5, 4));
    ensure_equals("name 3", f3.name.str, "_123135");
    ensure("position 4", f4.name.pos == sl::FilePosition("", 6, 5));
    ensure_equals("name 4", f4.name.str, "aAa");
    ensure("position 5", f5.name.pos == sl::FilePosition("", 7, 6));
    ensure_equals("name 5", f5.name.str, "_64_characters__________________________________________________");
}
 void filter_object::test<4>()
 {
     set_test_name("LLEventTimeout::errorAfter()");
     WrapLLErrs capture;
     LLEventPump& driver(pumps.obtain("driver"));
     TestEventTimeout filter(driver);
     listener0.reset(0);
     LLTempBoundListener temp1(
         listener0.listenTo(filter));
     filter.errorAfter(20, "timeout");
     // Okay, (fake) timer is ticking. 'filter' can only sense the timer
     // when we pump mainloop. Do that right now to take the logic path
     // before either the anticipated event arrives or the timer expires.
     mainloop.post(17);
     check_listener("no timeout 1", listener0, LLSD(0));
     // Expected event arrives...
     driver.post(1);
     check_listener("event passed thru", listener0, LLSD(1));
     // Should have canceled the timer. Verify that by asserting that the
     // time has expired, then pumping mainloop again.
     filter.forceTimeout();
     mainloop.post(17);
     check_listener("no timeout 2", listener0, LLSD(1));
     // Set timer again.
     filter.errorAfter(20, "timeout");
     // Now let the timer expire.
     filter.forceTimeout();
     // Notice the timeout.
     std::string threw;
     try
     {
         mainloop.post(17);
     }
     catch (const WrapLLErrs::FatalException& e)
     {
         threw = e.what();
     }
     ensure_contains("errorAfter() timeout exception", threw, "timeout");
     // Timing out cancels the timer. Verify that.
     listener0.reset(0);
     filter.forceTimeout();
     mainloop.post(17);
     check_listener("no timeout 3", listener0, LLSD(0));
 }
 void object::test<1>()
 {
     set_test_name("request validation");
     WrapLL_ERRS capture;
     LLSD request;
     request["uri"] = uri;
     std::string threw;
     try
     {
         pumps.obtain("LLXMLRPCTransaction").post(request);
     }
     catch (const WrapLL_ERRS::FatalException& e)
     {
         threw = e.what();
     }
     ensure_contains("threw exception", threw, "missing params");
     ensure_contains("identified missing", threw, "method");
     ensure_contains("identified missing", threw, "reply");
 }
Beispiel #21
0
 void fixture::test<3>()
 {
     data d;
     set_test_name("equal operator");
     pthreadxx::thread t1, t2;
     ensure("invalid threads are equal", t1 == t2);
     ensure_not("invalid threads are not unequal", t1 != t2);
     ensure("self compare are equal", t1 == t1);
     ensure_not("self compare are not unequal", t1 != t1);
     t1=t1;
     ensure("self compare are equal", t1 == t1);
     ensure_not("self compare are not unequal", t1 != t1);
     t1 = pthreadxx::thread::create(d);
     ensure_not("threads are unequal", t1 == t2);
     ensure("invalid threads are not equal", t1 != t2);
     t2 = pthreadxx::thread::create(d);
     ensure_not("threads are unequal", t1 == t2);
     ensure("invalid threads are not equal", t1 != t2);
 }
Beispiel #22
0
 void fixture::test<4>()
 {
     set_test_name("test add multiple node");
     algorithm::const_hash hash;
     int count = random (1, 20);
     for (int i = 0; i < count; ++i)
     {
         int weight = random(100, 200);
         hash.add(i, weight);
         ensure_equals("hash weight", hash.weight(i), weight);
     }
     ensure_equals("hash count", hash.alive_set().size(), count);
     int loop = random (200, 300);
     for (int i = 0; i < loop; ++i)
     {
         ensure("node in alive_set", 
                 hash.alive_set().count(hash.hash(random())) == 1); 
     }
 }
    void object::test<13>()
    {
        set_test_name("Test to make sure both setWhiteList() functions behave the same");

        // Test an invalid list, too many
        std::vector<std::string> whitelist, empty;
        LLSD whitelist_llsd;
        for (int i=0; i < LLMediaEntry::MAX_WHITELIST_SIZE+1; i++) {
            whitelist.push_back("Q");
            whitelist_llsd.append("Q");
        }
        LLMediaEntry entry1, entry2;
        ensure(get_test_name() + " invalid result", 
               entry1.setWhiteList(whitelist) == LSL_STATUS_BOUNDS_ERROR &&
               entry2.setWhiteList(whitelist_llsd) == LSL_STATUS_BOUNDS_ERROR);
        ensure(get_test_name() + " failed", 
               empty == entry1.getWhiteList() &&
               empty == entry2.getWhiteList());
    }
Beispiel #24
0
void TestRegistry::test<2>()
{
    set_test_name("Cofactor (3x3 matrix)");

    // Determinant of this matrix is -2
    a3f[0] = 5.0f; a3f[3] = 6.0f; a3f[6] = 3.0f;
    a3f[1] = 4.0f; a3f[4] = 3.0f; a3f[7] = 1.0f;
    a3f[2] = 1.0f; a3f[5] = 4.0f; a3f[8] = 3.0f;

    jship::Hazmat::Cofactor(a3f, b3f);
    
    DOUBLES_EQUAL(a3f[0], 5.0, 1e-5);
    DOUBLES_EQUAL(a3f[1], 4.0, 1e-5);
    DOUBLES_EQUAL(a3f[2], 1.0, 1e-5);
    DOUBLES_EQUAL(a3f[3], 6.0, 1e-5);
    DOUBLES_EQUAL(a3f[4], 3.0, 1e-5);
    DOUBLES_EQUAL(a3f[5], 4.0, 1e-5);
    DOUBLES_EQUAL(a3f[6], 3.0, 1e-5);
    DOUBLES_EQUAL(a3f[7], 1.0, 1e-5);
    DOUBLES_EQUAL(a3f[8], 3.0, 1e-5);
    
    DOUBLES_EQUAL(b3f[0],   5.0, 1e-5);
    DOUBLES_EQUAL(b3f[1],  -6.0, 1e-5);
    DOUBLES_EQUAL(b3f[2],  -3.0, 1e-5);
    DOUBLES_EQUAL(b3f[3], -11.0, 1e-5);
    DOUBLES_EQUAL(b3f[4],  12.0, 1e-5);
    DOUBLES_EQUAL(b3f[5],   7.0, 1e-5);
    DOUBLES_EQUAL(b3f[6],  13.0, 1e-5);
    DOUBLES_EQUAL(b3f[7], -14.0, 1e-5);
    DOUBLES_EQUAL(b3f[8],  -9.0, 1e-5);
    
    jship::Hazmat::Cofactor(a3f, a3f);
    
    DOUBLES_EQUAL(a3f[0],   5.0, 1e-5);
    DOUBLES_EQUAL(a3f[1],  -6.0, 1e-5);
    DOUBLES_EQUAL(a3f[2],  -3.0, 1e-5);
    DOUBLES_EQUAL(a3f[3], -11.0, 1e-5);
    DOUBLES_EQUAL(a3f[4],  12.0, 1e-5);
    DOUBLES_EQUAL(a3f[5],   7.0, 1e-5);
    DOUBLES_EQUAL(a3f[6],  13.0, 1e-5);
    DOUBLES_EQUAL(a3f[7], -14.0, 1e-5);
    DOUBLES_EQUAL(a3f[8],  -9.0, 1e-5);
}
void object::test<7>()
{
    set_test_name("delete Unkeyed with outstanding instance_iter");
    std::string what;
    Unkeyed* unkeyed = new Unkeyed;
    {
        WrapLL_ERRS wrapper;
        Unkeyed::instance_iter i(Unkeyed::beginInstances());
        try
        {
            delete unkeyed;
        }
        catch (const WrapLL_ERRS::FatalException& e)
        {
            what = e.what();
        }
    }
    ensure(! what.empty());
}
void object::test<6>()
{
    set_test_name("delete Keyed with outstanding key_iter");
    std::string what;
    Keyed* keyed = new Keyed("one");
    {
        WrapLL_ERRS wrapper;
        Keyed::key_iter i(Keyed::beginKeys());
        try
        {
            delete keyed;
        }
        catch (const WrapLL_ERRS::FatalException& e)
        {
            what = e.what();
        }
    }
    ensure(! what.empty());
}
Beispiel #27
0
void TestRegistry::test<2>()
{
    set_test_name("Transpose (3x3 matrix)");

    a3f[0] = 0.0f; a3f[3] = 3.0f; a3f[6] = 6.0f;
    a3f[1] = 1.0f; a3f[4] = 4.0f; a3f[7] = 7.0f;
    a3f[2] = 2.0f; a3f[5] = 5.0f; a3f[8] = 8.0f;

    jship::Hazmat::Transpose(a3f, b3f);
    
    DOUBLES_EQUAL(a3f[0],  0.0, 1e-5);
    DOUBLES_EQUAL(a3f[1],  1.0, 1e-5);
    DOUBLES_EQUAL(a3f[2],  2.0, 1e-5);
    DOUBLES_EQUAL(a3f[3],  3.0, 1e-5);
    DOUBLES_EQUAL(a3f[4],  4.0, 1e-5);
    DOUBLES_EQUAL(a3f[5],  5.0, 1e-5);
    DOUBLES_EQUAL(a3f[6],  6.0, 1e-5);
    DOUBLES_EQUAL(a3f[7],  7.0, 1e-5);
    DOUBLES_EQUAL(a3f[8],  8.0, 1e-5);
    
    DOUBLES_EQUAL(b3f[0], 0.0, 1e-5);
    DOUBLES_EQUAL(b3f[1], 3.0, 1e-5);
    DOUBLES_EQUAL(b3f[2], 6.0, 1e-5);
    DOUBLES_EQUAL(b3f[3], 1.0, 1e-5);
    DOUBLES_EQUAL(b3f[4], 4.0, 1e-5);
    DOUBLES_EQUAL(b3f[5], 7.0, 1e-5);
    DOUBLES_EQUAL(b3f[6], 2.0, 1e-5);
    DOUBLES_EQUAL(b3f[7], 5.0, 1e-5);
    DOUBLES_EQUAL(b3f[8], 8.0, 1e-5);
    
    jship::Hazmat::Transpose(a3f, a3f);
    
    DOUBLES_EQUAL(a3f[0], 0.0, 1e-5);
    DOUBLES_EQUAL(a3f[1], 3.0, 1e-5);
    DOUBLES_EQUAL(a3f[2], 6.0, 1e-5);
    DOUBLES_EQUAL(a3f[3], 1.0, 1e-5);
    DOUBLES_EQUAL(a3f[4], 4.0, 1e-5);
    DOUBLES_EQUAL(a3f[5], 7.0, 1e-5);
    DOUBLES_EQUAL(a3f[6], 2.0, 1e-5);
    DOUBLES_EQUAL(a3f[7], 5.0, 1e-5);
    DOUBLES_EQUAL(a3f[8], 8.0, 1e-5);
}
Beispiel #28
0
void object::test<4>()
{
    set_test_name("bad function names");

    setCode(),
        "module Asia;",
        "bad+x() -> void { }";

    parse();
    
    ensure_failure(1);

    setCode(),
        "module Asia;",
        "123() -> void { }";

    parse();
    
    ensure_failure(1);
}
void test_group<test_data>::object::test<7>() {
	set_test_name("Test merging overflow");

	// Cantidad máxima de pares clave-valor que entran en el nodo
	int number_of_pairs =
			(block_size - 3 * sizeof(int)) / (sizeof(int) + sizeof(int));

	left_node.set_leftmost_pointer(0);
	for (int i = 1; i < number_of_pairs; i++) {
		left_node.insert_key_in_order(i * 10, i);
	}

	right_node.set_leftmost_pointer(0);
	for (int i = 1; i < number_of_pairs; i++) {
		right_node.insert_key_in_order(i * 10, i);
	}

	node_type::merge_result r = left_node.try_merge(&left_node, &right_node, 350);
	ensure(!r.success);
}
 void object::test<2>()
 {
     set_test_name("param types validation");
     WrapLL_ERRS capture;
     LLSD request;
     request["uri"] = uri;
     request["method"] = "hello";
     request["reply"] = "reply";
     LLSD& params(request["params"]);
     params["who"]["specifically"] = "world"; // LLXMLRPCListener only handles scalar params
     std::string threw;
     try
     {
         pumps.obtain("LLXMLRPCTransaction").post(request);
     }
     catch (const WrapLL_ERRS::FatalException& e)
     {
         threw = e.what();
     }
     ensure_contains("threw exception", threw, "unknown type");
 }