@@ -1616,32 +1616,94 @@ TEST(GeometryTest, VerticesConstructorAndGetters) {
16161616}
16171617
16181618TEST (GeometryTest, MatrixPrinting) {
1619- std::stringstream stream;
1620-
1621- Matrix m;
1622-
1623- stream << m;
1624-
1625- ASSERT_EQ (stream.str (), R"( (
1619+ {
1620+ std::stringstream stream;
1621+ Matrix m;
1622+ stream << m;
1623+ ASSERT_EQ (stream.str (), R"( (
16261624 1.000000, 0.000000, 0.000000, 0.000000,
16271625 0.000000, 1.000000, 0.000000, 0.000000,
16281626 0.000000, 0.000000, 1.000000, 0.000000,
16291627 0.000000, 0.000000, 0.000000, 1.000000,
16301628))" );
1629+ }
16311630
1632- stream.str (" " );
1633- stream.clear ();
1634-
1635- m = Matrix::MakeTranslation (Vector3 (10 , 20 , 30 ));
1636-
1637- stream << m;
1631+ {
1632+ std::stringstream stream;
1633+ Matrix m = Matrix::MakeTranslation (Vector3 (10 , 20 , 30 ));
1634+ stream << m;
16381635
1639- ASSERT_EQ (stream.str (), R"( (
1636+ ASSERT_EQ (stream.str (), R"( (
16401637 1.000000, 0.000000, 0.000000, 10.000000,
16411638 0.000000, 1.000000, 0.000000, 20.000000,
16421639 0.000000, 0.000000, 1.000000, 30.000000,
16431640 0.000000, 0.000000, 0.000000, 1.000000,
16441641))" );
1642+ }
1643+ }
1644+
1645+ TEST (GeometryTest, PointPrinting) {
1646+ {
1647+ std::stringstream stream;
1648+ Point m;
1649+ stream << m;
1650+ ASSERT_EQ (stream.str (), " (0, 0)" );
1651+ }
1652+
1653+ {
1654+ std::stringstream stream;
1655+ Point m (13 , 37 );
1656+ stream << m;
1657+ ASSERT_EQ (stream.str (), " (13, 37)" );
1658+ }
1659+ }
1660+
1661+ TEST (GeometryTest, Vector3Printing) {
1662+ {
1663+ std::stringstream stream;
1664+ Vector3 m;
1665+ stream << m;
1666+ ASSERT_EQ (stream.str (), " (0, 0, 0)" );
1667+ }
1668+
1669+ {
1670+ std::stringstream stream;
1671+ Vector3 m (1 , 2 , 3 );
1672+ stream << m;
1673+ ASSERT_EQ (stream.str (), " (1, 2, 3)" );
1674+ }
1675+ }
1676+
1677+ TEST (GeometryTest, Vector4Printing) {
1678+ {
1679+ std::stringstream stream;
1680+ Vector4 m;
1681+ stream << m;
1682+ ASSERT_EQ (stream.str (), " (0, 0, 0, 1)" );
1683+ }
1684+
1685+ {
1686+ std::stringstream stream;
1687+ Vector4 m (1 , 2 , 3 , 4 );
1688+ stream << m;
1689+ ASSERT_EQ (stream.str (), " (1, 2, 3, 4)" );
1690+ }
1691+ }
1692+
1693+ TEST (GeometryTest, ColorPrinting) {
1694+ {
1695+ std::stringstream stream;
1696+ Color m;
1697+ stream << m;
1698+ ASSERT_EQ (stream.str (), " (0, 0, 0, 0)" );
1699+ }
1700+
1701+ {
1702+ std::stringstream stream;
1703+ Color m (1 , 2 , 3 , 4 );
1704+ stream << m;
1705+ ASSERT_EQ (stream.str (), " (1, 2, 3, 4)" );
1706+ }
16451707}
16461708
16471709TEST (GeometryTest, Gradient) {
0 commit comments