summaryrefslogtreecommitdiff
path: root/indra/llmath/tests/v4color_test.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-08-28 20:47:43 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-08-28 20:47:43 -0400
commitcde1174345224d33d6b45b1e3243fa39043223e5 (patch)
tree6c8db6e0499622d8c7206a11c997eb173ebd478f /indra/llmath/tests/v4color_test.cpp
parent6f454ad8366ed33bbe199c3fc3ed69e6d3448cec (diff)
parent35efadf78315f9b351415930dca4fae251ef4dd0 (diff)
Merge branch 'main' into release/luau-scripting.
Diffstat (limited to 'indra/llmath/tests/v4color_test.cpp')
-rw-r--r--indra/llmath/tests/v4color_test.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/indra/llmath/tests/v4color_test.cpp b/indra/llmath/tests/v4color_test.cpp
index 3b3adbda0d..e5d914a065 100644
--- a/indra/llmath/tests/v4color_test.cpp
+++ b/indra/llmath/tests/v4color_test.cpp
@@ -49,23 +49,23 @@ namespace tut
void v4color_object::test<1>()
{
LLColor4 llcolor4;
- ensure("1:LLColor4:Fail to initialize ", ((0 == llcolor4.mV[VX]) && (0 == llcolor4.mV[VY]) && (0 == llcolor4.mV[VZ])&& (1.0f == llcolor4.mV[VW])));
+ ensure("1:LLColor4:Fail to initialize ", ((0 == llcolor4.mV[VRED]) && (0 == llcolor4.mV[VGREEN]) && (0 == llcolor4.mV[VBLUE])&& (1.0f == llcolor4.mV[VALPHA])));
F32 r = 0x20, g = 0xFFFF, b = 0xFF, a = 0xAF;
LLColor4 llcolor4a(r,g,b);
- ensure("2:LLColor4:Fail to initialize ", ((r == llcolor4a.mV[VX]) && (g == llcolor4a.mV[VY]) && (b == llcolor4a.mV[VZ])&& (1.0f == llcolor4a.mV[VW])));
+ ensure("2:LLColor4:Fail to initialize ", ((r == llcolor4a.mV[VRED]) && (g == llcolor4a.mV[VGREEN]) && (b == llcolor4a.mV[VBLUE])&& (1.0f == llcolor4a.mV[VALPHA])));
LLColor4 llcolor4b(r,g,b,a);
- ensure("3:LLColor4:Fail to initialize ", ((r == llcolor4b.mV[VX]) && (g == llcolor4b.mV[VY]) && (b == llcolor4b.mV[VZ])&& (a == llcolor4b.mV[VW])));
+ ensure("3:LLColor4:Fail to initialize ", ((r == llcolor4b.mV[VRED]) && (g == llcolor4b.mV[VGREEN]) && (b == llcolor4b.mV[VBLUE])&& (a == llcolor4b.mV[VALPHA])));
const F32 vec[4] = {.112f ,23.2f, -4.2f, -.0001f};
LLColor4 llcolor4c(vec);
- ensure("4:LLColor4:Fail to initialize ", ((vec[0] == llcolor4c.mV[VX]) && (vec[1] == llcolor4c.mV[VY]) && (vec[2] == llcolor4c.mV[VZ])&& (vec[3] == llcolor4c.mV[VW])));
+ ensure("4:LLColor4:Fail to initialize ", ((vec[0] == llcolor4c.mV[VRED]) && (vec[1] == llcolor4c.mV[VGREEN]) && (vec[2] == llcolor4c.mV[VBLUE])&& (vec[3] == llcolor4c.mV[VALPHA])));
LLColor3 llcolor3(-2.23f,1.01f,42.3f);
F32 val = -.1f;
LLColor4 llcolor4d(llcolor3,val);
- ensure("5:LLColor4:Fail to initialize ", ((llcolor3.mV[VX] == llcolor4d.mV[VX]) && (llcolor3.mV[VY] == llcolor4d.mV[VY]) && (llcolor3.mV[VZ] == llcolor4d.mV[VZ])&& (val == llcolor4d.mV[VW])));
+ ensure("5:LLColor4:Fail to initialize ", ((llcolor3.mV[VRED] == llcolor4d.mV[VRED]) && (llcolor3.mV[VGREEN] == llcolor4d.mV[VGREEN]) && (llcolor3.mV[VBLUE] == llcolor4d.mV[VBLUE])&& (val == llcolor4d.mV[VALPHA])));
LLSD sd = llcolor4d.getValue();
LLColor4 llcolor4e(sd);
@@ -76,7 +76,7 @@ namespace tut
LLColor4 llcolor4g(color4u);
const F32 SCALE = 1.f/255.f;
F32 r2 = r1*SCALE, g2 = g1* SCALE, b2 = b1* SCALE;
- ensure("7:LLColor4:Fail to initialize ", ((r2 == llcolor4g.mV[VX]) && (g2 == llcolor4g.mV[VY]) && (b2 == llcolor4g.mV[VZ])));
+ ensure("7:LLColor4:Fail to initialize ", ((r2 == llcolor4g.mV[VRED]) && (g2 == llcolor4g.mV[VGREEN]) && (b2 == llcolor4g.mV[VBLUE])));
}
template<> template<>
@@ -98,10 +98,10 @@ namespace tut
F32 r = 0x20, g = 0xFFFF, b = 0xFF,a = 0xAF;
LLColor4 llcolor4(r,g,b,a);
llcolor4.setToBlack();
- ensure("setToBlack:Fail to set the black ", ((0 == llcolor4.mV[VX]) && (0 == llcolor4.mV[VY]) && (0 == llcolor4.mV[VZ])&& (1.0f == llcolor4.mV[VW])));
+ ensure("setToBlack:Fail to set the black ", ((0 == llcolor4.mV[VRED]) && (0 == llcolor4.mV[VGREEN]) && (0 == llcolor4.mV[VBLUE])&& (1.0f == llcolor4.mV[VALPHA])));
llcolor4.setToWhite();
- ensure("setToWhite:Fail to set the white ", ((1.f == llcolor4.mV[VX]) && (1.f == llcolor4.mV[VY]) && (1.f == llcolor4.mV[VZ])&& (1.0f == llcolor4.mV[VW])));
+ ensure("setToWhite:Fail to set the white ", ((1.f == llcolor4.mV[VRED]) && (1.f == llcolor4.mV[VGREEN]) && (1.f == llcolor4.mV[VBLUE])&& (1.0f == llcolor4.mV[VALPHA])));
}
template<> template<>
@@ -110,10 +110,10 @@ namespace tut
F32 r = 0x20, g = 0xFFFF, b = 0xFF, a = 0xAF;
LLColor4 llcolor4;
llcolor4.setVec(r,g,b);
- ensure("1:setVec:Fail to set the values ", ((r == llcolor4.mV[VX]) && (g == llcolor4.mV[VY]) && (b == llcolor4.mV[VZ])&& (1.f == llcolor4.mV[VW])));
+ ensure("1:setVec:Fail to set the values ", ((r == llcolor4.mV[VRED]) && (g == llcolor4.mV[VGREEN]) && (b == llcolor4.mV[VBLUE])&& (1.f == llcolor4.mV[VALPHA])));
llcolor4.setVec(r,g,b,a);
- ensure("2:setVec:Fail to set the values ", ((r == llcolor4.mV[VX]) && (g == llcolor4.mV[VY]) && (b == llcolor4.mV[VZ])&& (a == llcolor4.mV[VW])));
+ ensure("2:setVec:Fail to set the values ", ((r == llcolor4.mV[VRED]) && (g == llcolor4.mV[VGREEN]) && (b == llcolor4.mV[VBLUE])&& (a == llcolor4.mV[VALPHA])));
LLColor4 llcolor4a;
llcolor4a.setVec(llcolor4);
@@ -121,23 +121,23 @@ namespace tut
LLColor3 llcolor3(-2.23f,1.01f,42.3f);
llcolor4a.setVec(llcolor3);
- ensure("4:setVec:Fail to set the values ", ((llcolor3.mV[VX] == llcolor4a.mV[VX]) && (llcolor3.mV[VY] == llcolor4a.mV[VY]) && (llcolor3.mV[VZ] == llcolor4a.mV[VZ])));
+ ensure("4:setVec:Fail to set the values ", ((llcolor3.mV[VRED] == llcolor4a.mV[VRED]) && (llcolor3.mV[VGREEN] == llcolor4a.mV[VGREEN]) && (llcolor3.mV[VBLUE] == llcolor4a.mV[VBLUE])));
F32 val = -.33f;
llcolor4a.setVec(llcolor3,val);
- ensure("4:setVec:Fail to set the values ", ((llcolor3.mV[VX] == llcolor4a.mV[VX]) && (llcolor3.mV[VY] == llcolor4a.mV[VY]) && (llcolor3.mV[VZ] == llcolor4a.mV[VZ]) && (val == llcolor4a.mV[VW])));
+ ensure("4:setVec:Fail to set the values ", ((llcolor3.mV[VRED] == llcolor4a.mV[VRED]) && (llcolor3.mV[VGREEN] == llcolor4a.mV[VGREEN]) && (llcolor3.mV[VBLUE] == llcolor4a.mV[VBLUE]) && (val == llcolor4a.mV[VALPHA])));
const F32 vec[4] = {.112f ,23.2f, -4.2f, -.0001f};
LLColor4 llcolor4c;
llcolor4c.setVec(vec);
- ensure("5:setVec:Fail to initialize ", ((vec[0] == llcolor4c.mV[VX]) && (vec[1] == llcolor4c.mV[VY]) && (vec[2] == llcolor4c.mV[VZ])&& (vec[3] == llcolor4c.mV[VW])));
+ ensure("5:setVec:Fail to initialize ", ((vec[0] == llcolor4c.mV[VRED]) && (vec[1] == llcolor4c.mV[VGREEN]) && (vec[2] == llcolor4c.mV[VBLUE])&& (vec[3] == llcolor4c.mV[VALPHA])));
U8 r1 = 0xF2, g1 = 0xFA, b1= 0xBF;
LLColor4U color4u(r1,g1,b1);
llcolor4.setVec(color4u);
const F32 SCALE = 1.f/255.f;
F32 r2 = r1*SCALE, g2 = g1* SCALE, b2 = b1* SCALE;
- ensure("6:setVec:Fail to initialize ", ((r2 == llcolor4.mV[VX]) && (g2 == llcolor4.mV[VY]) && (b2 == llcolor4.mV[VZ])));
+ ensure("6:setVec:Fail to initialize ", ((r2 == llcolor4.mV[VRED]) && (g2 == llcolor4.mV[VGREEN]) && (b2 == llcolor4.mV[VBLUE])));
}
template<> template<>
@@ -146,7 +146,7 @@ namespace tut
F32 alpha = 0xAF;
LLColor4 llcolor4;
llcolor4.setAlpha(alpha);
- ensure("setAlpha:Fail to initialize ", (alpha == llcolor4.mV[VW]));
+ ensure("setAlpha:Fail to initialize ", (alpha == llcolor4.mV[VALPHA]));
}
template<> template<>
@@ -209,7 +209,7 @@ namespace tut
LLColor3 llcolor3(r,g,b);
LLColor4 llcolor4a,llcolor4b;
llcolor4a = llcolor3;
- ensure("Operator=:Fail to initialize ", ((llcolor3.mV[0] == llcolor4a.mV[VX]) && (llcolor3.mV[1] == llcolor4a.mV[VY]) && (llcolor3.mV[2] == llcolor4a.mV[VZ])));
+ ensure("Operator=:Fail to initialize ", ((llcolor3.mV[0] == llcolor4a.mV[VRED]) && (llcolor3.mV[1] == llcolor4a.mV[VGREEN]) && (llcolor3.mV[2] == llcolor4a.mV[VBLUE])));
LLSD sd = llcolor4a.getValue();
llcolor4b = LLColor4(sd);
ensure_equals("Operator= LLSD:Fail ", llcolor4a, llcolor4b);
@@ -234,10 +234,10 @@ namespace tut
F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF;
LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c;
llcolor4c = llcolor4b + llcolor4a;
- ensure("operator+:Fail to Add the values ", (is_approx_equal(r1+r2,llcolor4c.mV[VX]) && is_approx_equal(g1+g2,llcolor4c.mV[VY]) && is_approx_equal(b1+b2,llcolor4c.mV[VZ])));
+ ensure("operator+:Fail to Add the values ", (is_approx_equal(r1+r2,llcolor4c.mV[VRED]) && is_approx_equal(g1+g2,llcolor4c.mV[VGREEN]) && is_approx_equal(b1+b2,llcolor4c.mV[VBLUE])));
llcolor4b += llcolor4a;
- ensure("operator+=:Fail to Add the values ", (is_approx_equal(r1+r2,llcolor4b.mV[VX]) && is_approx_equal(g1+g2,llcolor4b.mV[VY]) && is_approx_equal(b1+b2,llcolor4b.mV[VZ])));
+ ensure("operator+=:Fail to Add the values ", (is_approx_equal(r1+r2,llcolor4b.mV[VRED]) && is_approx_equal(g1+g2,llcolor4b.mV[VGREEN]) && is_approx_equal(b1+b2,llcolor4b.mV[VBLUE])));
}
template<> template<>
@@ -247,10 +247,10 @@ namespace tut
F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF;
LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c;
llcolor4c = llcolor4a - llcolor4b;
- ensure("operator-:Fail to subtract the values ", (is_approx_equal(r1-r2,llcolor4c.mV[VX]) && is_approx_equal(g1-g2,llcolor4c.mV[VY]) && is_approx_equal(b1-b2,llcolor4c.mV[VZ])));
+ ensure("operator-:Fail to subtract the values ", (is_approx_equal(r1-r2,llcolor4c.mV[VRED]) && is_approx_equal(g1-g2,llcolor4c.mV[VGREEN]) && is_approx_equal(b1-b2,llcolor4c.mV[VBLUE])));
llcolor4a -= llcolor4b;
- ensure("operator-=:Fail to subtract the values ", (is_approx_equal(r1-r2,llcolor4a.mV[VX]) && is_approx_equal(g1-g2,llcolor4a.mV[VY]) && is_approx_equal(b1-b2,llcolor4a.mV[VZ])));
+ ensure("operator-=:Fail to subtract the values ", (is_approx_equal(r1-r2,llcolor4a.mV[VRED]) && is_approx_equal(g1-g2,llcolor4a.mV[VGREEN]) && is_approx_equal(b1-b2,llcolor4a.mV[VBLUE])));
}
template<> template<>
@@ -260,20 +260,20 @@ namespace tut
F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF;
LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c;
llcolor4c = llcolor4a * llcolor4b;
- ensure("1:operator*:Fail to multiply the values", (is_approx_equal(r1*r2,llcolor4c.mV[VX]) && is_approx_equal(g1*g2,llcolor4c.mV[VY]) && is_approx_equal(b1*b2,llcolor4c.mV[VZ])));
+ ensure("1:operator*:Fail to multiply the values", (is_approx_equal(r1*r2,llcolor4c.mV[VRED]) && is_approx_equal(g1*g2,llcolor4c.mV[VGREEN]) && is_approx_equal(b1*b2,llcolor4c.mV[VBLUE])));
F32 mulVal = 3.33f;
llcolor4c = llcolor4a * mulVal;
- ensure("2:operator*:Fail ", (is_approx_equal(r1*mulVal,llcolor4c.mV[VX]) && is_approx_equal(g1*mulVal,llcolor4c.mV[VY]) && is_approx_equal(b1*mulVal,llcolor4c.mV[VZ])));
+ ensure("2:operator*:Fail ", (is_approx_equal(r1*mulVal,llcolor4c.mV[VRED]) && is_approx_equal(g1*mulVal,llcolor4c.mV[VGREEN]) && is_approx_equal(b1*mulVal,llcolor4c.mV[VBLUE])));
llcolor4c = mulVal * llcolor4a;
- ensure("3:operator*:Fail to multiply the values", (is_approx_equal(r1*mulVal,llcolor4c.mV[VX]) && is_approx_equal(g1*mulVal,llcolor4c.mV[VY]) && is_approx_equal(b1*mulVal,llcolor4c.mV[VZ])));
+ ensure("3:operator*:Fail to multiply the values", (is_approx_equal(r1*mulVal,llcolor4c.mV[VRED]) && is_approx_equal(g1*mulVal,llcolor4c.mV[VGREEN]) && is_approx_equal(b1*mulVal,llcolor4c.mV[VBLUE])));
llcolor4a *= mulVal;
- ensure("4:operator*=:Fail to multiply the values ", (is_approx_equal(r1*mulVal,llcolor4a.mV[VX]) && is_approx_equal(g1*mulVal,llcolor4a.mV[VY]) && is_approx_equal(b1*mulVal,llcolor4a.mV[VZ])));
+ ensure("4:operator*=:Fail to multiply the values ", (is_approx_equal(r1*mulVal,llcolor4a.mV[VRED]) && is_approx_equal(g1*mulVal,llcolor4a.mV[VGREEN]) && is_approx_equal(b1*mulVal,llcolor4a.mV[VBLUE])));
LLColor4 llcolor4d(r1,g1,b1),llcolor4e(r2,g2,b2);
llcolor4e *= llcolor4d;
- ensure("5:operator*=:Fail to multiply the values ", (is_approx_equal(r1*r2,llcolor4e.mV[VX]) && is_approx_equal(g1*g2,llcolor4e.mV[VY]) && is_approx_equal(b1*b2,llcolor4e.mV[VZ])));
+ ensure("5:operator*=:Fail to multiply the values ", (is_approx_equal(r1*r2,llcolor4e.mV[VRED]) && is_approx_equal(g1*g2,llcolor4e.mV[VGREEN]) && is_approx_equal(b1*b2,llcolor4e.mV[VBLUE])));
}
template<> template<>
@@ -283,13 +283,13 @@ namespace tut
F32 div = 12.345f;
LLColor4 llcolor4a(r,g,b,a),llcolor4b;
llcolor4b = llcolor4a % div;//chnage only alpha value nor r,g,b;
- ensure("1operator%:Fail ", (is_approx_equal(r,llcolor4b.mV[VX]) && is_approx_equal(g,llcolor4b.mV[VY]) && is_approx_equal(b,llcolor4b.mV[VZ])&& is_approx_equal(div*a,llcolor4b.mV[VW])));
+ ensure("1operator%:Fail ", (is_approx_equal(r,llcolor4b.mV[VRED]) && is_approx_equal(g,llcolor4b.mV[VGREEN]) && is_approx_equal(b,llcolor4b.mV[VBLUE])&& is_approx_equal(div*a,llcolor4b.mV[VALPHA])));
llcolor4b = div % llcolor4a;
- ensure("2operator%:Fail ", (is_approx_equal(r,llcolor4b.mV[VX]) && is_approx_equal(g,llcolor4b.mV[VY]) && is_approx_equal(b,llcolor4b.mV[VZ])&& is_approx_equal(div*a,llcolor4b.mV[VW])));
+ ensure("2operator%:Fail ", (is_approx_equal(r,llcolor4b.mV[VRED]) && is_approx_equal(g,llcolor4b.mV[VGREEN]) && is_approx_equal(b,llcolor4b.mV[VBLUE])&& is_approx_equal(div*a,llcolor4b.mV[VALPHA])));
llcolor4a %= div;
- ensure("operator%=:Fail ", (is_approx_equal(a*div,llcolor4a.mV[VW])));
+ ensure("operator%=:Fail ", (is_approx_equal(a*div,llcolor4a.mV[VALPHA])));
}
template<> template<>
@@ -312,7 +312,7 @@ namespace tut
F32 r = 0x20, g = 0xFFFF, b = 0xFF;
LLColor4 llcolor4a(r,g,b),llcolor4b;
LLColor3 llcolor3 = vec4to3(llcolor4a);
- ensure("vec4to3:Fail to convert vec4 to vec3 ", (is_approx_equal(llcolor3.mV[VX],llcolor4a.mV[VX]) && is_approx_equal(llcolor3.mV[VY],llcolor4a.mV[VY]) && is_approx_equal(llcolor3.mV[VZ],llcolor4a.mV[VZ])));
+ ensure("vec4to3:Fail to convert vec4 to vec3 ", (is_approx_equal(llcolor3.mV[VRED],llcolor4a.mV[VRED]) && is_approx_equal(llcolor3.mV[VGREEN],llcolor4a.mV[VGREEN]) && is_approx_equal(llcolor3.mV[VBLUE],llcolor4a.mV[VBLUE])));
llcolor4b = vec3to4(llcolor3);
ensure_equals("vec3to4:Fail to convert vec3 to vec4 ", llcolor4b, llcolor4a);
}
@@ -324,7 +324,7 @@ namespace tut
F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF;
LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c;
llcolor4c = lerp(llcolor4a,llcolor4b,val);
- ensure("lerp:Fail ", (is_approx_equal(r1 + (r2 - r1)* val,llcolor4c.mV[VX]) && is_approx_equal(g1 + (g2 - g1)* val,llcolor4c.mV[VY]) && is_approx_equal(b1 + (b2 - b1)* val,llcolor4c.mV[VZ])));
+ ensure("lerp:Fail ", (is_approx_equal(r1 + (r2 - r1)* val,llcolor4c.mV[VRED]) && is_approx_equal(g1 + (g2 - g1)* val,llcolor4c.mV[VGREEN]) && is_approx_equal(b1 + (b2 - b1)* val,llcolor4c.mV[VBLUE])));
}
template<> template<>