// Testing of UnitQuaternion multiplication
TYPED_TEST (UnitQuaternionsSingleTest, testUnitQuaternionSingleMultiplication) {
    typedef typename TestFixture::UnitQuaternion UnitQuaternion;
    typedef typename TestFixture::UnitQuaternionScalar UnitQuaternionScalar;
    typedef typename TestFixture::EigenQuat EigenQuat;
    UnitQuaternion testQuat;

    // Check multiplication of two generic quaternions and compare with eigen results
    UnitQuaternion quat12 = this->quat1*this->quat2;
    EigenQuat eigenQuat12 = this->eigenQuat1*this->eigenQuat2;
    ASSERT_EQ(quat12.w(),eigenQuat12.w());
    ASSERT_EQ(quat12.x(),eigenQuat12.x());
    ASSERT_EQ(quat12.y(),eigenQuat12.y());
    ASSERT_EQ(quat12.z(),eigenQuat12.z());

    // Check result of multiplication of a generic quaternion with identity
    testQuat = this->quat1*this->quatIdentity;
    ASSERT_EQ(testQuat.w(),this->quat1.w());
    ASSERT_EQ(testQuat.x(),this->quat1.x());
    ASSERT_EQ(testQuat.y(),this->quat1.y());
    ASSERT_EQ(testQuat.z(),this->quat1.z());
    testQuat = this->quatIdentity*this->quat1;
    ASSERT_EQ(testQuat.w(),this->quat1.w());
    ASSERT_EQ(testQuat.x(),this->quat1.x());
    ASSERT_EQ(testQuat.y(),this->quat1.y());
    ASSERT_EQ(testQuat.z(),this->quat1.z());
}
// Testing vector() and constructor from vector
TYPED_TEST (UnitQuaternionsSingleTest, testQuaternionSingleVectorAndVectorConstructor) {
    typedef typename TestFixture::UnitQuaternion UnitQuaternion;
    typedef typename TestFixture::UnitQuaternionScalar UnitQuaternionScalar;
    typedef Eigen::Matrix<UnitQuaternionScalar, 4, 1> Vector4;
    UnitQuaternion quat = this->quat1;

    // vector()
    Vector4 vector = quat.vector();
    ASSERT_NEAR(quat.w(),vector(0), 1e-3);
    ASSERT_NEAR(quat.x(),vector(1), 1e-3);
    ASSERT_NEAR(quat.y(),vector(2), 1e-3);
    ASSERT_NEAR(quat.z(),vector(3), 1e-3);

    // constructor from vector
    UnitQuaternion quatFromVector(vector);
    ASSERT_NEAR(quat.w(),quatFromVector.w(), 1e-3);
    ASSERT_NEAR(quat.x(),quatFromVector.x(), 1e-3);
    ASSERT_NEAR(quat.y(),quatFromVector.y(), 1e-3);
    ASSERT_NEAR(quat.z(),quatFromVector.z(), 1e-3);
}
// Testing of UnitQuaternion Constructor and Access Operator
TYPED_TEST (UnitQuaternionsSingleTest, testUnitQuaternionSingleConstructor) {
    typedef typename TestFixture::UnitQuaternion UnitQuaternion;
    typedef typename TestFixture::UnitQuaternionScalar UnitQuaternionScalar;
    typedef typename TestFixture::EigenQuat EigenQuat;

    // Default constructor of quaternion needs to set all coefficients to zero
    UnitQuaternion testQuat;
    ASSERT_EQ(testQuat.w(),UnitQuaternionScalar(1));
    ASSERT_EQ(testQuat.x(),UnitQuaternionScalar(0));
    ASSERT_EQ(testQuat.y(),UnitQuaternionScalar(0));
    ASSERT_EQ(testQuat.z(),UnitQuaternionScalar(0));

    // Constructor of quaternion using 4 scalars
    UnitQuaternion testQuat1(this->eigenQuat1.w(), this->eigenQuat1.x(), this->eigenQuat1.y(), this->eigenQuat1.z());
    ASSERT_EQ(testQuat1.w(),this->eigenQuat1.w());
    ASSERT_EQ(testQuat1.x(),this->eigenQuat1.x());
    ASSERT_EQ(testQuat1.y(),this->eigenQuat1.y());
    ASSERT_EQ(testQuat1.z(),this->eigenQuat1.z());

    // Constructor of quaternion using real and imaginary part
    UnitQuaternion testQuat2(this->eigenQuat1.w(),typename UnitQuaternion::Imaginary(this->eigenQuat1.x(), this->eigenQuat1.y(), this->eigenQuat1.z()));
    ASSERT_EQ(testQuat2.w(),this->eigenQuat1.w());
    ASSERT_EQ(testQuat2.x(),this->eigenQuat1.x());
    ASSERT_EQ(testQuat2.y(),this->eigenQuat1.y());
    ASSERT_EQ(testQuat2.z(),this->eigenQuat1.z());
    ASSERT_EQ(testQuat2.real(),this->eigenQuat1.w());
    ASSERT_EQ(testQuat2.imaginary()(0),this->eigenQuat1.x());
    ASSERT_EQ(testQuat2.imaginary()(1),this->eigenQuat1.y());
    ASSERT_EQ(testQuat2.imaginary()(2),this->eigenQuat1.z());

    // Constructor of quaternion using eigen quaternion
    UnitQuaternion testQuat3(this->eigenQuat1);
    ASSERT_EQ(testQuat3.w(),this->eigenQuat1.w());
    ASSERT_EQ(testQuat3.x(),this->eigenQuat1.x());
    ASSERT_EQ(testQuat3.y(),this->eigenQuat1.y());
    ASSERT_EQ(testQuat3.z(),this->eigenQuat1.z());
}