[FEAT] Fix tuple and color operators
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* 01_colors.cpp
|
||||
* 02_colors.cpp
|
||||
*
|
||||
* Copyright (c) 2015-2024, NADAL Jean-Baptiste. All rights reserved.
|
||||
*
|
||||
@@ -63,8 +63,6 @@ TEST_CASE("Adding colors", "[Colors]")
|
||||
Color c1(0.9, 0.6, 0.75);
|
||||
Color c2(0.7, 0.1, 0.25);
|
||||
|
||||
//Color c3 = c1 + c2;
|
||||
|
||||
REQUIRE((c1 + c2) == Color(1.6, 0.7, 1.0));
|
||||
}
|
||||
|
||||
@@ -92,9 +90,32 @@ TEST_CASE("Subtracting colors", "[Colors]")
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
TEST_CASE("Subtracting colors without modify c1", "[Colors]")
|
||||
{
|
||||
Color c1(0.9, 0.6, 0.75);
|
||||
Color c2(0.7, 0.1, 0.25);
|
||||
|
||||
Color c3 = c1 - c2;
|
||||
|
||||
REQUIRE((c1 - c2) == Color(0.2, 0.5, 0.5));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
TEST_CASE("Multiplying a color by a scalar", "[Colors]")
|
||||
{
|
||||
Color c(0.2, 0.3, 0.4);
|
||||
|
||||
REQUIRE(c * 2 == Color(0.4, 0.6, 0.8));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
TEST_CASE("Multiplying a color by a scalar without modify c", "[Colors]")
|
||||
{
|
||||
Color c(0.2, 0.3, 0.4);
|
||||
|
||||
Color c3 = c * 4;
|
||||
|
||||
REQUIRE(c * 2 == Color(0.4, 0.6, 0.8));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user