void test_copy() { menvelope->setDoubleAttr("spdiameter", 13.0); TS_ASSERT_EQUALS(13.0, menvelope->getDoubleAttr("spdiameter")); PDFEnvelopePtr e1 = menvelope->clone(); TS_ASSERT_EQUALS(13.0, e1->getDoubleAttr("spdiameter")); }
void PDFEnvelopeOwner::addEnvelopeByType(const string& tp) { // this throws invalid_argument for invalid type PDFEnvelopePtr envlp = PDFEnvelope::createByType(tp); // we get here only when createByType was successful menvelope[envlp->type()] = envlp; }
void test_create() { TS_ASSERT_EQUALS(0.0, menvelope->getDoubleAttr("spdiameter")); menvelope->setDoubleAttr("spdiameter", 13.0); TS_ASSERT_EQUALS(13.0, menvelope->getDoubleAttr("spdiameter")); PDFEnvelopePtr e1 = menvelope->create(); TS_ASSERT_EQUALS(0.0, e1->getDoubleAttr("spdiameter")); }
void test_serialization() { menvelope->setDoubleAttr("spdiameter", 13.1); PDFEnvelopePtr e1 = dumpandload(menvelope); TS_ASSERT_EQUALS(string("sphericalshape"), e1->type()); TS_ASSERT_EQUALS(13.1, e1->getDoubleAttr("spdiameter")); }
void test_parentheses_operator() { const PDFEnvelope& fne = *menvelope; TS_ASSERT_EQUALS(1.0, fne(0.0)); TS_ASSERT_EQUALS(1.0, fne(100.0)); menvelope->setDoubleAttr("spdiameter", 10.0); TS_ASSERT_EQUALS(1.0, fne(0.0)); TS_ASSERT_EQUALS(0.0, fne(10.0)); TS_ASSERT_EQUALS(0.0, fne(100)); TS_ASSERT(fne(9.99) > 0.0); TS_ASSERT_DELTA(0.3125, fne(5), 1e-8); }
void PDFEnvelopeOwner::addEnvelope(PDFEnvelopePtr envlp) { ensureNonNull("PDFEnvelope", envlp); menvelope[envlp->type()] = envlp; }
void test_type() { TS_ASSERT_EQUALS("sphericalshape", menvelope->type()); }