void fixture::test<3>() { set_test_name("test add one node"); int loop =0; algorithm::const_hash hash; ensure("default hash empty", hash.empty()); hash.add(0, 1); ensure_not("hash not empty", hash.empty()); ensure_not("hash alive_set not empty", hash.alive_set().empty()); ensure_equals("hash alive_set has node 0", hash.alive_set().count(0), 1); ensure_equals("hash node 0 weight", hash.weight(0), 1); loop = random(1, 100); for (int i = 0; i < loop; ++i) { ensure_equals("hash resource to node 0", hash.hash(random()), 0); } hash.add(0, 99); ensure_not("hash not empty", hash.empty()); ensure_not("hash alive_set not empty", hash.alive_set().empty()); ensure_equals("hash alive_set has node 0", hash.alive_set().count(0), 1); ensure_equals("hash node 0 weight", hash.weight(0), 100); loop = random(1, 100); for (int i = 0; i < loop; ++i) { ensure_equals("hash resource to node 0", hash.hash(random()), 0); } ensure_THROW(hash.hash(2), std::range_error); ensure_THROW(hash.add(1, algorithm::const_hash::MAX_NODES-99), std::range_error); ensure_equals("node 1 has no weight", hash.weight(1), 0); ensure_equals("node 1 not in alive_set", hash.alive_set().count(1), 0); }
void to::test<18>() { liblas::Classification c; c.SetKeyPoint(true); c.SetClass(1); c.SetSynthetic(true); c.SetWithheld(true); ensure(c.IsWithheld()); ensure(c.IsKeyPoint()); ensure(c.IsSynthetic()); ensure_equals(c.GetClass(), 1); ensure_not(c == m_default); c.SetKeyPoint(false); c.SetSynthetic(false); c.SetClass(0); c.SetWithheld(false); ensure_not(c.IsWithheld()); ensure_not(c.IsKeyPoint()); ensure_not(c.IsSynthetic()); ensure_equals(c.GetClass(), 0); liblas::Classification::bitset_type bits1(c); liblas::Classification::bitset_type bits2(m_default); ensure_equals(c, m_default); }
void object::test<1>() { set_test_name("checks ensure_not"); ensure_not("ok", 1==2); ensure_not(1==2); }
void to::test<1>() { ensure_equals(m_default, bitset_type(0)); ensure_equals(m_default.GetClass(), 0); ensure_not(m_default.IsSynthetic()); ensure_not(m_default.IsKeyPoint()); ensure_not(m_default.IsWithheld()); }
void fixture::test<6>() { set_test_name("test erase"); algorithm::const_hash hash; hash.add(0, 100); ensure_not("hash not empty", hash.empty()); ensure_not("hash alive_set not empty", hash.alive_set().empty()); ensure_equals("hash alive_set has one node", hash.alive_set().size(), 1); ensure_equals("hash alive_set has node 0", hash.alive_set().count(0), 1); ensure_equals("hash node 0 weight", hash.weight(0), 100); hash.erase(1); ensure_not("hash not empty", hash.empty()); ensure_not("hash alive_set not empty", hash.alive_set().empty()); ensure_equals("hash alive_set has one node", hash.alive_set().size(), 1); ensure_equals("hash alive_set has node 0", hash.alive_set().count(0), 1); hash.erase(0); ensure("hash empty", hash.empty()); ensure("hash alive_set empty", hash.alive_set().empty()); ensure_equals("hash alive_set has no node", hash.alive_set().size(), 0); ensure_equals("hash alive_set has no node 0", hash.alive_set().count(0), 0); hash.add(1, 50); hash.add(2, 50); ensure_equals("hash alive_set has 2 nodes", hash.alive_set().size(), 2); ensure_equals("hash alive_set has no node 0", hash.alive_set().count(0), 0); ensure_equals("hash alive_set has node 1", hash.alive_set().count(1), 1); ensure_equals("hash alive_set has node 2", hash.alive_set().count(2), 1); ensure_equals("hash node 0 weight", hash.weight(0), 0); ensure_equals("hash node 1 weight", hash.weight(1), 50); ensure_equals("hash node 2 weight", hash.weight(2), 50); hash.erase(2); ensure_equals("hash alive_set has 1 nodes", hash.alive_set().size(), 1); ensure_equals("hash alive_set has no node 0", hash.alive_set().count(0), 0); ensure_equals("hash alive_set has node 1", hash.alive_set().count(1), 1); ensure_equals("hash alive_set has node 2", hash.alive_set().count(2), 0); ensure_equals("hash node 0 weight", hash.weight(0), 0); ensure_equals("hash node 1 weight", hash.weight(1), 50); ensure_equals("hash node 2 weight", hash.weight(2), 0); }
void to::test<5>() { liblas::Classification c(31, false, false, false); ensure_equals(c.GetClass(), 31); ensure_not(c.IsSynthetic()); ensure_not(c.IsKeyPoint()); ensure_not(c.IsWithheld()); ensure_equals(c, bitset_type(std::string("00011111"))); }
void object::test<3>() { set_test_name("checks attempt to run invalid test in existent group"); test_result r; // running non-existant test should return false ensure_not( tr.run_test("runner_internal", -1, r) ); ensure_not( tr.run_test("runner_internal", 100000, r) ); }
void to::test<3>() { liblas::Classification c31(0x1F); ensure_not(c31 == m_default); ensure_equals(c31.GetClass(), 31); ensure_not(c31.IsSynthetic()); ensure_not(c31.IsKeyPoint()); ensure_not(c31.IsWithheld()); }
void to::test<2>() { liblas::Classification c0(0); ensure_equals(c0, m_default); ensure_equals(c0, bitset_type(0)); ensure_equals(c0.GetClass(), 0); ensure_not(c0.IsSynthetic()); ensure_not(c0.IsKeyPoint()); ensure_not(c0.IsWithheld()); }
void to::test<11>() { lasreader_iterator it(reader_); // move to 1st point lasreader_iterator end; ensure_not(end == it); }
void tgArrayObject::test<6>() { array.create(20); ensure("Initializated operator bool validation", array); array.release(); ensure_not("Initializated operator bool validation", array); }
void to::test<6>() { liblas::Classification c(7, true, false, true); ensure_equals(c.GetClass(), 7); ensure_not(c.IsKeyPoint()); ensure(c.IsWithheld()); ensure(c.IsSynthetic()); ensure_equals(c, bitset_type(std::string("10100111"))); }
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); }
void to::test<11>() { ensure_equals("invalid default classification", m_default.GetClassification(), liblas::Classification::bitset_type()); boost::uint8_t const begclass = 0; liblas::Classification c(begclass, false, true, false); m_default.SetClassification(c); ensure_equals("invalid class index", m_default.GetClassification().GetClass(), begclass); ensure_not("synthetic bit", m_default.GetClassification().IsSynthetic()); ensure("keypoint bit", m_default.GetClassification().IsKeyPoint()); ensure_not("withheld bit", m_default.GetClassification().IsWithheld()); { // Not paranoid, just show how to manually inspect flags std::ostringstream oss; oss << m_default.GetClassification().GetFlags(); ensure_equals(oss.str(), "01000000"); } boost::uint8_t const endclass = 31; c.SetClass(endclass); c.SetSynthetic(true); c.SetKeyPoint(true); c.SetWithheld(false); m_default.SetClassification(c); ensure_equals("invalid class index", m_default.GetClassification().GetClass(), endclass); ensure("synthetic bit", m_default.GetClassification().IsSynthetic()); ensure("keypoint bit", m_default.GetClassification().IsKeyPoint()); ensure_not("withheld bit", m_default.GetClassification().IsWithheld()); { // Not paranoid, just show how to manually inspect flags std::ostringstream oss; oss << m_default.GetClassification().GetFlags(); ensure_equals(oss.str(), "01111111"); } }
void to::test<15>() { liblas::Classification c; c.SetWithheld(true); ensure(c.IsWithheld()); ensure(c != m_default); c.SetWithheld(false); ensure_not(c.IsWithheld()); ensure_equals(c, m_default); c.SetWithheld(true); ensure(c.IsWithheld()); ensure(c != m_default); c.SetWithheld(false); ensure_not(c.IsWithheld()); ensure_equals(c, m_default); ensure_equals(c.GetClass(), 0); }
void to::test<14>() { liblas::Classification c; c.SetKeyPoint(true); ensure(c.IsKeyPoint()); ensure(c != m_default); c.SetKeyPoint(false); ensure_not(c.IsKeyPoint()); ensure_equals(c, m_default); c.SetKeyPoint(true); ensure(c.IsKeyPoint()); ensure(c != m_default); c.SetKeyPoint(false); ensure_not(c.IsKeyPoint()); ensure_equals(c, m_default); ensure_equals(c.GetClass(), 0); }
void to::test<13>() { liblas::Classification c; c.SetSynthetic(true); ensure(c.IsSynthetic()); ensure(c != m_default); c.SetSynthetic(false); ensure_not(c.IsSynthetic()); ensure_equals(c, m_default); c.SetSynthetic(true); ensure(c.IsSynthetic()); ensure(c != m_default); c.SetSynthetic(false); ensure_not(c.IsSynthetic()); ensure_equals(c, m_default); ensure_equals(c.GetClass(), 0); }
void to::test<15>() { { liblas::Point p; boost::uint16_t const outofrange = 8; p.SetReturnNumber(outofrange); // XXX: Bit flag overflowed, so point data recognized as valid //ensure_not(p.IsValid()); } { liblas::Point p; boost::uint16_t const outofrange = 8; p.SetNumberOfReturns(outofrange); // XXX: Bit flag overflowed, so point data recognized as valid //ensure_not(p.IsValid()); } { liblas::Point p; boost::uint16_t const outofrange = 2; p.SetScanDirection(outofrange); // XXX: Bit flag overflowed, so point data recognized as valid //ensure_not(p.IsValid()); } { liblas::Point p; boost::uint16_t const outofrange = 2; p.SetFlightLineEdge(outofrange); // XXX: Bit flag overflowed, so point data recognized as valid //ensure_not(p.IsValid()); } { liblas::Point p; boost::int8_t const outofrange = 91; p.SetScanAngleRank(outofrange); ensure_not(p.IsValid()); } }
void object::test<2> () { LineIntersector li; Coordinate pt(10, 10); HotPixel hp(pt, 10, li); ensure_equals(hp.getCoordinate(), pt); const Envelope& env = hp.getSafeEnvelope(); ensure_equals(env.toString(), "Env[9.925:10.075,9.925:10.075]"); Coordinate p0(0, 10); Coordinate p1(20, 10); ensure("hp.intersects 0 10, 20 10", hp.intersects(p0, p1)); p1.y = 11; // intersection point not within 0.075 distance ensure_not("hp.intersects(0 10, 20 11)", hp.intersects(p0, p1)); }
void tgArrayObject::test<3>() { ensure_not("Not initializated operator bool validation", array); }
void fixture::test<1>() { set_test_name("default constructor"); pthreadxx::thread t; ensure_not("default thread is invalid", t.valid()); }
void ensure_failure() { ensure_not("module", module); }
void ensure_failure(unsigned errorCount) { ensure_not("module", module); ensure_equals("errors", el.errors().size(), errorCount); }