Improve error reporting from DSL unit tests.

Previously, a DSL unit test failure would not report the actual text
generated by the DSL, or the line number of the failure.

Added a new macro EXPECT_EQUAL which
- supports DSL statements, DSL expressions, and IR nodes equally
- reports both the expected string and actual DSL output
- reports the line number of the failure
- always compares in a whitespace-insensitive fashion
- supports passing rvalue DSL expressions directly, rather than forcing
  us to create single-use lvalues for each test

Existing DSL tests have been updated to use this macro.

A failing test looks like this:

FAILURE: ../../tests/SkSLDSLTest.cpp:107	(Failed on line 146)
Expected: float4(0.0, 1.0, 2.0, 3.0)
  Actual: float4(0.0, 1.0, 2.0, 4.0)
 [DSLFloat, Mock]

Change-Id: Ie99d449690252f289bf48a66ab9c58e19dda9a07
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372198
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/tests/SkSLDSLTest.cpp b/tests/SkSLDSLTest.cpp
index e1700d9..cafe67a 100644
--- a/tests/SkSLDSLTest.cpp
+++ b/tests/SkSLDSLTest.cpp
@@ -73,14 +73,6 @@
     }
 }
 
-static bool whitespace_insensitive_compare(DSLStatement& stmt, const char* description) {
-    return whitespace_insensitive_compare(stmt.release()->description().c_str(), description);
-}
-
-static bool whitespace_insensitive_compare(SkSL::IRNode& node, const char* description) {
-    return whitespace_insensitive_compare(node.description().c_str(), description);
-}
-
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLStartup, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Expression e1 = 1;
@@ -103,6 +95,27 @@
     REPORTER_ASSERT(r, !whitespace_insensitive_compare("a b c  d", "\n\n\nabc"));
 }
 
+static SkSL::String stringize(DSLStatement& stmt)  { return stmt.release()->description(); }
+static SkSL::String stringize(DSLExpression& expr) { return expr.release()->description(); }
+static SkSL::String stringize(SkSL::IRNode& node)  { return node.description(); }
+
+template <typename T>
+static void expect_equal(skiatest::Reporter* r, int lineNumber, T& input, const char* expected) {
+    SkSL::String actual = stringize(input);
+    if (!whitespace_insensitive_compare(expected, actual.c_str())) {
+        ERRORF(r, "(Failed on line %d)\nExpected: %s\n  Actual: %s\n",
+                  lineNumber, expected, actual.c_str());
+    }
+}
+
+template <typename T>
+static void expect_equal(skiatest::Reporter* r, int lineNumber, T&& dsl, const char* expected) {
+    // This overload allows temporary values to be passed to expect_equal.
+    return expect_equal(r, lineNumber, dsl, expected);
+}
+
+#define EXPECT_EQUAL(a, b)  expect_equal(r, __LINE__, (a), (b))
+
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLFloat, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Expression e1 = Float(std::numeric_limits<float>::max());
@@ -113,32 +126,24 @@
     REPORTER_ASSERT(r, atof(e2.release()->description().c_str()) ==
                        std::numeric_limits<float>::min());
 
-    Expression e3 = Float2(0);
-    REPORTER_ASSERT(r, e3.release()->description() == "float2(0.0)");
-
-    Expression e4 = Float2(-0.5, 1);
-    REPORTER_ASSERT(r, e4.release()->description() == "float2(-0.5, 1.0)");
-
-    Expression e5 = Float3(0.75);
-    REPORTER_ASSERT(r, e5.release()->description() == "float3(0.75)");
-
-    Expression e6 = Float3(Float2(0, 1), -2);
-    REPORTER_ASSERT(r, e6.release()->description() == "float3(float2(0.0, 1.0), -2.0)");
-
-    Expression e7 = Float3(0, 1, 2);
-    REPORTER_ASSERT(r, e7.release()->description() == "float3(0.0, 1.0, 2.0)");
-
-    Expression e8 = Float4(0);
-    REPORTER_ASSERT(r, e8.release()->description() == "float4(0.0)");
-
-    Expression e9 = Float4(Float2(0, 1), Float2(2, 3));
-    REPORTER_ASSERT(r, e9.release()->description() == "float4(float2(0.0, 1.0), float2(2.0, 3.0))");
-
-    Expression e10 = Float4(0, 1, Float2(2, 3));
-    REPORTER_ASSERT(r, e10.release()->description() == "float4(0.0, 1.0, float2(2.0, 3.0))");
-
-    Expression e11 = Float4(0, 1, 2, 3);
-    REPORTER_ASSERT(r, e11.release()->description() == "float4(0.0, 1.0, 2.0, 3.0)");
+    EXPECT_EQUAL(Float2(0),
+                "float2(0.0)");
+    EXPECT_EQUAL(Float2(-0.5, 1),
+                "float2(-0.5, 1.0)");
+    EXPECT_EQUAL(Float3(0.75),
+                "float3(0.75)");
+    EXPECT_EQUAL(Float3(Float2(0, 1), -2),
+                "float3(float2(0.0, 1.0), -2.0)");
+    EXPECT_EQUAL(Float3(0, 1, 2),
+                "float3(0.0, 1.0, 2.0)");
+    EXPECT_EQUAL(Float4(0),
+                "float4(0.0)");
+    EXPECT_EQUAL(Float4(Float2(0, 1), Float2(2, 3)),
+                "float4(float2(0.0, 1.0), float2(2.0, 3.0))");
+    EXPECT_EQUAL(Float4(0, 1, Float2(2, 3)),
+                "float4(0.0, 1.0, float2(2.0, 3.0))");
+    EXPECT_EQUAL(Float4(0, 1, 2, 3),
+                "float4(0.0, 1.0, 2.0, 3.0)");
 
     {
         ExpectError error(r, "error: floating point value is infinite\n");
@@ -166,39 +171,39 @@
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLHalf, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Expression e1 = Half(std::numeric_limits<float>::max());
-    REPORTER_ASSERT(r, atof(e1.release()->description().c_str()) ==
-                       std::numeric_limits<float>::max());
+    REPORTER_ASSERT(r,
+                    atof(e1.release()->description().c_str()) == std::numeric_limits<float>::max());
 
     Expression e2 = Half(std::numeric_limits<float>::min());
-    REPORTER_ASSERT(r, atof(e2.release()->description().c_str()) ==
-                       std::numeric_limits<float>::min());
+    REPORTER_ASSERT(r,
+                    atof(e2.release()->description().c_str()) == std::numeric_limits<float>::min());
 
     Expression e3 = Half2(0);
-    REPORTER_ASSERT(r, e3.release()->description() == "half2(0.0)");
+    EXPECT_EQUAL(e3, "half2(0.0)");
 
     Expression e4 = Half2(-0.5, 1);
-    REPORTER_ASSERT(r, e4.release()->description() == "half2(-0.5, 1.0)");
+    EXPECT_EQUAL(e4, "half2(-0.5, 1.0)");
 
     Expression e5 = Half3(0.75);
-    REPORTER_ASSERT(r, e5.release()->description() == "half3(0.75)");
+    EXPECT_EQUAL(e5, "half3(0.75)");
 
     Expression e6 = Half3(Half2(0, 1), -2);
-    REPORTER_ASSERT(r, e6.release()->description() == "half3(half2(0.0, 1.0), -2.0)");
+    EXPECT_EQUAL(e6, "half3(half2(0.0, 1.0), -2.0)");
 
     Expression e7 = Half3(0, 1, 2);
-    REPORTER_ASSERT(r, e7.release()->description() == "half3(0.0, 1.0, 2.0)");
+    EXPECT_EQUAL(e7, "half3(0.0, 1.0, 2.0)");
 
     Expression e8 = Half4(0);
-    REPORTER_ASSERT(r, e8.release()->description() == "half4(0.0)");
+    EXPECT_EQUAL(e8, "half4(0.0)");
 
     Expression e9 = Half4(Half2(0, 1), Half2(2, 3));
-    REPORTER_ASSERT(r, e9.release()->description() == "half4(half2(0.0, 1.0), half2(2.0, 3.0))");
+    EXPECT_EQUAL(e9, "half4(half2(0.0, 1.0), half2(2.0, 3.0))");
 
     Expression e10 = Half4(0, 1, Half2(2, 3));
-    REPORTER_ASSERT(r, e10.release()->description() == "half4(0.0, 1.0, half2(2.0, 3.0))");
+    EXPECT_EQUAL(e10, "half4(0.0, 1.0, half2(2.0, 3.0))");
 
     Expression e11 = Half4(0, 1, 2, 3);
-    REPORTER_ASSERT(r, e11.release()->description() == "half4(0.0, 1.0, 2.0, 3.0)");
+    EXPECT_EQUAL(e11, "half4(0.0, 1.0, 2.0, 3.0)");
 
     {
         ExpectError error(r, "error: floating point value is infinite\n");
@@ -226,34 +231,34 @@
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLInt, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Expression e1 = Int(std::numeric_limits<int32_t>::max());
-    REPORTER_ASSERT(r, e1.release()->description() == "2147483647");
+    EXPECT_EQUAL(e1, "2147483647");
 
     Expression e2 = Int2(std::numeric_limits<int32_t>::min());
-    REPORTER_ASSERT(r, e2.release()->description() == "int2(-2147483648)");
+    EXPECT_EQUAL(e2, "int2(-2147483648)");
 
     Expression e3 = Int2(0, 1);
-    REPORTER_ASSERT(r, e3.release()->description() == "int2(0, 1)");
+    EXPECT_EQUAL(e3, "int2(0, 1)");
 
     Expression e4 = Int3(0);
-    REPORTER_ASSERT(r, e4.release()->description() == "int3(0)");
+    EXPECT_EQUAL(e4, "int3(0)");
 
     Expression e5 = Int3(Int2(0, 1), -2);
-    REPORTER_ASSERT(r, e5.release()->description() == "int3(int2(0, 1), -2)");
+    EXPECT_EQUAL(e5, "int3(int2(0, 1), -2)");
 
     Expression e6 = Int3(0, 1, 2);
-    REPORTER_ASSERT(r, e6.release()->description() == "int3(0, 1, 2)");
+    EXPECT_EQUAL(e6, "int3(0, 1, 2)");
 
     Expression e7 = Int4(0);
-    REPORTER_ASSERT(r, e7.release()->description() == "int4(0)");
+    EXPECT_EQUAL(e7, "int4(0)");
 
     Expression e8 = Int4(Int2(0, 1), Int2(2, 3));
-    REPORTER_ASSERT(r, e8.release()->description() == "int4(int2(0, 1), int2(2, 3))");
+    EXPECT_EQUAL(e8, "int4(int2(0, 1), int2(2, 3))");
 
     Expression e9 = Int4(0, 1, Int2(2, 3));
-    REPORTER_ASSERT(r, e9.release()->description() == "int4(0, 1, int2(2, 3))");
+    EXPECT_EQUAL(e9, "int4(0, 1, int2(2, 3))");
 
     Expression e10 = Int4(0, 1, 2, 3);
-    REPORTER_ASSERT(r, e10.release()->description() == "int4(0, 1, 2, 3)");
+    EXPECT_EQUAL(e10, "int4(0, 1, 2, 3)");
 
     {
         ExpectError error(r, "error: invalid arguments to 'int2' constructor (expected 2 scalars,"
@@ -271,34 +276,34 @@
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLShort, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Expression e1 = Short(std::numeric_limits<int16_t>::max());
-    REPORTER_ASSERT(r, e1.release()->description() == "32767");
+    EXPECT_EQUAL(e1, "32767");
 
     Expression e2 = Short2(std::numeric_limits<int16_t>::min());
-    REPORTER_ASSERT(r, e2.release()->description() == "short2(-32768)");
+    EXPECT_EQUAL(e2, "short2(-32768)");
 
     Expression e3 = Short2(0, 1);
-    REPORTER_ASSERT(r, e3.release()->description() == "short2(0, 1)");
+    EXPECT_EQUAL(e3, "short2(0, 1)");
 
     Expression e4 = Short3(0);
-    REPORTER_ASSERT(r, e4.release()->description() == "short3(0)");
+    EXPECT_EQUAL(e4, "short3(0)");
 
     Expression e5 = Short3(Short2(0, 1), -2);
-    REPORTER_ASSERT(r, e5.release()->description() == "short3(short2(0, 1), -2)");
+    EXPECT_EQUAL(e5, "short3(short2(0, 1), -2)");
 
     Expression e6 = Short3(0, 1, 2);
-    REPORTER_ASSERT(r, e6.release()->description() == "short3(0, 1, 2)");
+    EXPECT_EQUAL(e6, "short3(0, 1, 2)");
 
     Expression e7 = Short4(0);
-    REPORTER_ASSERT(r, e7.release()->description() == "short4(0)");
+    EXPECT_EQUAL(e7, "short4(0)");
 
     Expression e8 = Short4(Short2(0, 1), Short2(2, 3));
-    REPORTER_ASSERT(r, e8.release()->description() == "short4(short2(0, 1), short2(2, 3))");
+    EXPECT_EQUAL(e8, "short4(short2(0, 1), short2(2, 3))");
 
     Expression e9 = Short4(0, 1, Short2(2, 3));
-    REPORTER_ASSERT(r, e9.release()->description() == "short4(0, 1, short2(2, 3))");
+    EXPECT_EQUAL(e9, "short4(0, 1, short2(2, 3))");
 
     Expression e10 = Short4(0, 1, 2, 3);
-    REPORTER_ASSERT(r, e10.release()->description() == "short4(0, 1, 2, 3)");
+    EXPECT_EQUAL(e10, "short4(0, 1, 2, 3)");
 
     {
         ExpectError error(r, "error: invalid arguments to 'short2' constructor (expected 2 scalars,"
@@ -316,32 +321,32 @@
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLBool, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Expression e1 = Bool2(false);
-    REPORTER_ASSERT(r, e1.release()->description() == "bool2(false)");
+    EXPECT_EQUAL(e1, "bool2(false)");
 
     Expression e2 = Bool2(false, true);
-    REPORTER_ASSERT(r, e2.release()->description() == "bool2(false, true)");
+    EXPECT_EQUAL(e2, "bool2(false, true)");
 
     Expression e3 = Bool3(false);
-    REPORTER_ASSERT(r, e3.release()->description() == "bool3(false)");
+    EXPECT_EQUAL(e3, "bool3(false)");
 
     Expression e4 = Bool3(Bool2(false, true), false);
-    REPORTER_ASSERT(r, e4.release()->description() == "bool3(bool2(false, true), false)");
+    EXPECT_EQUAL(e4, "bool3(bool2(false, true), false)");
 
     Expression e5 = Bool3(false, true, false);
-    REPORTER_ASSERT(r, e5.release()->description() == "bool3(false, true, false)");
+    EXPECT_EQUAL(e5, "bool3(false, true, false)");
 
     Expression e6 = Bool4(false);
-    REPORTER_ASSERT(r, e6.release()->description() == "bool4(false)");
+    EXPECT_EQUAL(e6, "bool4(false)");
 
     Expression e7 = Bool4(Bool2(false, true), Bool2(false, true));
-    REPORTER_ASSERT(r, e7.release()->description() == "bool4(bool2(false, true), "
+    EXPECT_EQUAL(e7, "bool4(bool2(false, true), "
                                                       "bool2(false, true))");
 
     Expression e8 = Bool4(false, true, Bool2(false, true));
-    REPORTER_ASSERT(r, e8.release()->description() == "bool4(false, true, bool2(false, true))");
+    EXPECT_EQUAL(e8, "bool4(false, true, bool2(false, true))");
 
     Expression e9 = Bool4(false, true, false, true);
-    REPORTER_ASSERT(r, e9.release()->description() == "bool4(false, true, false, true)");
+    EXPECT_EQUAL(e9, "bool4(false, true, false, true)");
 
     {
         ExpectError error(r, "error: invalid arguments to 'bool2' constructor (expected 2 scalars,"
@@ -360,16 +365,16 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kFloat, "a"), b(kFloat, "b");
     Expression e1 = a + b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a + b)");
+    EXPECT_EQUAL(e1, "(a + b)");
 
     Expression e2 = a + 1;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a + 1.0)");
+    EXPECT_EQUAL(e2, "(a + 1.0)");
 
     Expression e3 = 0.5 + a + -99;
-    REPORTER_ASSERT(r, e3.release()->description() == "((0.5 + a) + -99.0)");
+    EXPECT_EQUAL(e3, "((0.5 + a) + -99.0)");
 
     Expression e4 = a += b + 1;
-    REPORTER_ASSERT(r, e4.release()->description() == "(a += (b + 1.0))");
+    EXPECT_EQUAL(e4, "(a += (b + 1.0))");
 
     {
         ExpectError error(r, "error: type mismatch: '+' cannot operate on 'bool2', 'float'\n");
@@ -391,16 +396,16 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a - b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a - b)");
+    EXPECT_EQUAL(e1, "(a - b)");
 
     Expression e2 = a - 1;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a - 1)");
+    EXPECT_EQUAL(e2, "(a - 1)");
 
     Expression e3 = 2 - a - b;
-    REPORTER_ASSERT(r, e3.release()->description() == "((2 - a) - b)");
+    EXPECT_EQUAL(e3, "((2 - a) - b)");
 
     Expression e4 = a -= b + 1;
-    REPORTER_ASSERT(r, e4.release()->description() == "(a -= (b + 1))");
+    EXPECT_EQUAL(e4, "(a -= (b + 1))");
 
     {
         ExpectError error(r, "error: type mismatch: '-' cannot operate on 'bool2', 'int'\n");
@@ -422,16 +427,16 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kFloat, "a"), b(kFloat, "b");
     Expression e1 = a * b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a * b)");
+    EXPECT_EQUAL(e1, "(a * b)");
 
     Expression e2 = a * 1;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a * 1.0)");
+    EXPECT_EQUAL(e2, "(a * 1.0)");
 
     Expression e3 = 0.5 * a * -99;
-    REPORTER_ASSERT(r, e3.release()->description() == "((0.5 * a) * -99.0)");
+    EXPECT_EQUAL(e3, "((0.5 * a) * -99.0)");
 
     Expression e4 = a *= b + 1;
-    REPORTER_ASSERT(r, e4.release()->description() == "(a *= (b + 1.0))");
+    EXPECT_EQUAL(e4, "(a *= (b + 1.0))");
 
     {
         ExpectError error(r, "error: type mismatch: '*' cannot operate on 'bool2', 'float'\n");
@@ -453,19 +458,19 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kFloat, "a"), b(kFloat, "b");
     Expression e1 = a / b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a / b)");
+    EXPECT_EQUAL(e1, "(a / b)");
 
     Expression e2 = a / 1;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a / 1.0)");
+    EXPECT_EQUAL(e2, "(a / 1.0)");
 
     Expression e3 = 0.5 / a / -99;
-    REPORTER_ASSERT(r, e3.release()->description() == "((0.5 / a) / -99.0)");
+    EXPECT_EQUAL(e3, "((0.5 / a) / -99.0)");
 
     Expression e4 = b / (a - 1);
-    REPORTER_ASSERT(r, e4.release()->description() == "(b / (a - 1.0))");
+    EXPECT_EQUAL(e4, "(b / (a - 1.0))");
 
     Expression e5 = a /= b + 1;
-    REPORTER_ASSERT(r, e5.release()->description() == "(a /= (b + 1.0))");
+    EXPECT_EQUAL(e5, "(a /= (b + 1.0))");
 
     {
         ExpectError error(r, "error: type mismatch: '/' cannot operate on 'bool2', 'float'\n");
@@ -498,16 +503,16 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a % b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a % b)");
+    EXPECT_EQUAL(e1, "(a % b)");
 
     Expression e2 = a % 2;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a % 2)");
+    EXPECT_EQUAL(e2, "(a % 2)");
 
     Expression e3 = 10 % a % -99;
-    REPORTER_ASSERT(r, e3.release()->description() == "((10 % a) % -99)");
+    EXPECT_EQUAL(e3, "((10 % a) % -99)");
 
     Expression e4 = a %= b + 1;
-    REPORTER_ASSERT(r, e4.release()->description() == "(a %= (b + 1))");
+    EXPECT_EQUAL(e4, "(a %= (b + 1))");
 
     {
         ExpectError error(r, "error: type mismatch: '%' cannot operate on 'bool2', 'int'\n");
@@ -540,16 +545,16 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a << b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a << b)");
+    EXPECT_EQUAL(e1, "(a << b)");
 
     Expression e2 = a << 1;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a << 1)");
+    EXPECT_EQUAL(e2, "(a << 1)");
 
     Expression e3 = 1 << a << 2;
-    REPORTER_ASSERT(r, e3.release()->description() == "((1 << a) << 2)");
+    EXPECT_EQUAL(e3, "((1 << a) << 2)");
 
     Expression e4 = a <<= b + 1;
-    REPORTER_ASSERT(r, e4.release()->description() == "(a <<= (b + 1))");
+    EXPECT_EQUAL(e4, "(a <<= (b + 1))");
 
     {
         ExpectError error(r, "error: type mismatch: '<<' cannot operate on 'bool2', 'int'\n");
@@ -571,16 +576,16 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a >> b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a >> b)");
+    EXPECT_EQUAL(e1, "(a >> b)");
 
     Expression e2 = a >> 1;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a >> 1)");
+    EXPECT_EQUAL(e2, "(a >> 1)");
 
     Expression e3 = 1 >> a >> 2;
-    REPORTER_ASSERT(r, e3.release()->description() == "((1 >> a) >> 2)");
+    EXPECT_EQUAL(e3, "((1 >> a) >> 2)");
 
     Expression e4 = a >>= b + 1;
-    REPORTER_ASSERT(r, e4.release()->description() == "(a >>= (b + 1))");
+    EXPECT_EQUAL(e4, "(a >>= (b + 1))");
 
     {
         ExpectError error(r, "error: type mismatch: '>>' cannot operate on 'bool2', 'int'\n");
@@ -602,16 +607,16 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a & b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a & b)");
+    EXPECT_EQUAL(e1, "(a & b)");
 
     Expression e2 = a & 1;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a & 1)");
+    EXPECT_EQUAL(e2, "(a & 1)");
 
     Expression e3 = 1 & a & 2;
-    REPORTER_ASSERT(r, e3.release()->description() == "((1 & a) & 2)");
+    EXPECT_EQUAL(e3, "((1 & a) & 2)");
 
     Expression e4 = a &= b + 1;
-    REPORTER_ASSERT(r, e4.release()->description() == "(a &= (b + 1))");
+    EXPECT_EQUAL(e4, "(a &= (b + 1))");
 
     {
         ExpectError error(r, "error: type mismatch: '&' cannot operate on 'bool2', 'int'\n");
@@ -633,16 +638,16 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a | b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a | b)");
+    EXPECT_EQUAL(e1, "(a | b)");
 
     Expression e2 = a | 1;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a | 1)");
+    EXPECT_EQUAL(e2, "(a | 1)");
 
     Expression e3 = 1 | a | 2;
-    REPORTER_ASSERT(r, e3.release()->description() == "((1 | a) | 2)");
+    EXPECT_EQUAL(e3, "((1 | a) | 2)");
 
     Expression e4 = a |= b + 1;
-    REPORTER_ASSERT(r, e4.release()->description() == "(a |= (b + 1))");
+    EXPECT_EQUAL(e4, "(a |= (b + 1))");
 
     {
         ExpectError error(r, "error: type mismatch: '|' cannot operate on 'bool2', 'int'\n");
@@ -664,16 +669,16 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a ^ b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a ^ b)");
+    EXPECT_EQUAL(e1, "(a ^ b)");
 
     Expression e2 = a ^ 1;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a ^ 1)");
+    EXPECT_EQUAL(e2, "(a ^ 1)");
 
     Expression e3 = 1 ^ a ^ 2;
-    REPORTER_ASSERT(r, e3.release()->description() == "((1 ^ a) ^ 2)");
+    EXPECT_EQUAL(e3, "((1 ^ a) ^ 2)");
 
     Expression e4 = a ^= b + 1;
-    REPORTER_ASSERT(r, e4.release()->description() == "(a ^= (b + 1))");
+    EXPECT_EQUAL(e4, "(a ^= (b + 1))");
 
     {
         ExpectError error(r, "error: type mismatch: '^' cannot operate on 'bool2', 'int'\n");
@@ -695,13 +700,13 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kBool, "a"), b(kBool, "b");
     Expression e1 = a && b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a && b)");
+    EXPECT_EQUAL(e1, "(a && b)");
 
     Expression e2 = a && true && b;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a && b)");
+    EXPECT_EQUAL(e2, "(a && b)");
 
     Expression e3 = a && false && b;
-    REPORTER_ASSERT(r, e3.release()->description() == "false");
+    EXPECT_EQUAL(e3, "false");
 
     {
         ExpectError error(r, "error: type mismatch: '&&' cannot operate on 'bool', 'int'\n");
@@ -713,13 +718,13 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kBool, "a"), b(kBool, "b");
     Expression e1 = a || b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a || b)");
+    EXPECT_EQUAL(e1, "(a || b)");
 
     Expression e2 = a || true || b;
-    REPORTER_ASSERT(r, e2.release()->description() == "true");
+    EXPECT_EQUAL(e2, "true");
 
     Expression e3 = a || false || b;
-    REPORTER_ASSERT(r, e3.release()->description() == "(a || b)");
+    EXPECT_EQUAL(e3, "(a || b)");
 
     {
         ExpectError error(r, "error: type mismatch: '||' cannot operate on 'bool', 'int'\n");
@@ -731,20 +736,20 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = (a += b, b);
-    REPORTER_ASSERT(r, e1.release()->description() == "((a += b) , b)");
+    EXPECT_EQUAL(e1, "((a += b) , b)");
 
     Expression e2 = (a += b, b += b, Int2(a));
-    REPORTER_ASSERT(r, e2.release()->description() == "(((a += b) , (b += b)) , int2(a))");
+    EXPECT_EQUAL(e2, "(((a += b) , (b += b)) , int2(a))");
 }
 
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLEqual, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a == b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a == b)");
+    EXPECT_EQUAL(e1, "(a == b)");
 
     Expression e2 = a == 5;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a == 5)");
+    EXPECT_EQUAL(e2, "(a == 5)");
 
     {
         ExpectError error(r, "error: type mismatch: '==' cannot operate on 'int', 'bool2'\n");
@@ -756,10 +761,10 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a != b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a != b)");
+    EXPECT_EQUAL(e1, "(a != b)");
 
     Expression e2 = a != 5;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a != 5)");
+    EXPECT_EQUAL(e2, "(a != 5)");
 
     {
         ExpectError error(r, "error: type mismatch: '!=' cannot operate on 'int', 'bool2'\n");
@@ -771,10 +776,10 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a > b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a > b)");
+    EXPECT_EQUAL(e1, "(a > b)");
 
     Expression e2 = a > 5;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a > 5)");
+    EXPECT_EQUAL(e2, "(a > 5)");
 
     {
         ExpectError error(r, "error: type mismatch: '>' cannot operate on 'int', 'bool2'\n");
@@ -786,10 +791,10 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a >= b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a >= b)");
+    EXPECT_EQUAL(e1, "(a >= b)");
 
     Expression e2 = a >= 5;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a >= 5)");
+    EXPECT_EQUAL(e2, "(a >= 5)");
 
     {
         ExpectError error(r, "error: type mismatch: '>=' cannot operate on 'int', 'bool2'\n");
@@ -801,10 +806,10 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a < b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a < b)");
+    EXPECT_EQUAL(e1, "(a < b)");
 
     Expression e2 = a < 5;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a < 5)");
+    EXPECT_EQUAL(e2, "(a < 5)");
 
     {
         ExpectError error(r, "error: type mismatch: '<' cannot operate on 'int', 'bool2'\n");
@@ -816,10 +821,10 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = a <= b;
-    REPORTER_ASSERT(r, e1.release()->description() == "(a <= b)");
+    EXPECT_EQUAL(e1, "(a <= b)");
 
     Expression e2 = a <= 5;
-    REPORTER_ASSERT(r, e2.release()->description() == "(a <= 5)");
+    EXPECT_EQUAL(e2, "(a <= 5)");
 
     {
         ExpectError error(r, "error: type mismatch: '<=' cannot operate on 'int', 'bool2'\n");
@@ -831,7 +836,7 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kInt, "b");
     Expression e1 = !(a <= b);
-    REPORTER_ASSERT(r, e1.release()->description() == "!(a <= b)");
+    EXPECT_EQUAL(e1, "!(a <= b)");
 
     {
         ExpectError error(r, "error: '!' cannot operate on 'int'\n");
@@ -843,7 +848,7 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kBool, "b");
     Expression e1 = ~a;
-    REPORTER_ASSERT(r, e1.release()->description() == "~a");
+    EXPECT_EQUAL(e1, "~a");
 
     {
         ExpectError error(r, "error: '~' cannot operate on 'bool'\n");
@@ -855,10 +860,10 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kBool, "b");
     Expression e1 = ++a;
-    REPORTER_ASSERT(r, e1.release()->description() == "++a");
+    EXPECT_EQUAL(e1, "++a");
 
     Expression e2 = a++;
-    REPORTER_ASSERT(r, e2.release()->description() == "a++");
+    EXPECT_EQUAL(e2, "a++");
 
     {
         ExpectError error(r, "error: '++' cannot operate on 'bool'\n");
@@ -885,10 +890,10 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a"), b(kBool, "b");
     Expression e1 = --a;
-    REPORTER_ASSERT(r, e1.release()->description() == "--a");
+    EXPECT_EQUAL(e1, "--a");
 
     Expression e2 = a--;
-    REPORTER_ASSERT(r, e2.release()->description() == "a--");
+    EXPECT_EQUAL(e2, "a--");
 
     {
         ExpectError error(r, "error: '--' cannot operate on 'bool'\n");
@@ -914,10 +919,10 @@
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLBlock, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Statement x = Block();
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(x, "{ }"));
+    EXPECT_EQUAL(x, "{ }");
     Var a(kInt, "a"), b(kInt, "b");
     Statement y = Block(Declare(a, 1), Declare(b, 2), a = b);
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(y, "{ int a = 1; int b = 2; (a = b); }"));
+    EXPECT_EQUAL(y, "{ int a = 1; int b = 2; (a = b); }");
 }
 
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLBreak, r, ctxInfo) {
@@ -929,8 +934,8 @@
         ))
     );
     REPORTER_ASSERT(r, DSLWriter::ProgramElements().size() == 1);
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(*DSLWriter::ProgramElements()[0],
-            "void success() { for (int i = 0; (i < 10); ++i) { if ((i > 5)) break; } }"));
+    EXPECT_EQUAL(*DSLWriter::ProgramElements()[0],
+                 "void success() { for (int i = 0; (i < 10); ++i) { if ((i > 5)) break; } }");
 
     {
         ExpectError error(r, "error: break statement must be inside a loop or switch\n");
@@ -949,8 +954,8 @@
         ))
     );
     REPORTER_ASSERT(r, DSLWriter::ProgramElements().size() == 1);
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(*DSLWriter::ProgramElements()[0],
-            "void success() { for (int i = 0; (i < 10); ++i) { if ((i < 5)) continue; } }"));
+    EXPECT_EQUAL(*DSLWriter::ProgramElements()[0],
+                 "void success() { for (int i = 0; (i < 10); ++i) { if ((i < 5)) continue; } }");
 
     {
         ExpectError error(r, "error: continue statement must be inside a loop\n");
@@ -964,9 +969,9 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kHalf4, "a"), b(kHalf4, "b");
     Statement x = Declare(a);
-    REPORTER_ASSERT(r, x.release()->description() == "half4 a;");
+    EXPECT_EQUAL(x, "half4 a;");
     Statement y = Declare(b, Half4(1));
-    REPORTER_ASSERT(r, y.release()->description() == "half4 b = half4(1.0);");
+    EXPECT_EQUAL(y, "half4 b = half4(1.0);");
 
     {
         Var c(kHalf4, "c");
@@ -978,17 +983,17 @@
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLDiscard, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Statement x = If(Sqrt(1) > 0, Discard());
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(x, "if ((sqrt(1.0) > 0.0)) discard;"));
+    EXPECT_EQUAL(x, "if ((sqrt(1.0) > 0.0)) discard;");
 }
 
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLDo, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Statement x = Do(Block(), true);
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(x, "do {} while (true);"));
+    EXPECT_EQUAL(x, "do {} while (true);");
 
     Var a(kFloat, "a"), b(kFloat, "b");
     Statement y = Do(Block(a++, --b), a != b);
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(y, "do { a++; --b; } while ((a != b));"));
+    EXPECT_EQUAL(y, "do { a++; --b; } while ((a != b));");
 
     {
         ExpectError error(r, "error: expected 'bool', but found 'int'\n");
@@ -999,12 +1004,11 @@
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLFor, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Statement x = For(Statement(), Expression(), Expression(), Block());
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(x, "for (;;) {}"));
+    EXPECT_EQUAL(x, "for (;;) {}");
 
     Var i(kInt, "i");
     Statement y = For(Declare(i, 0), i < 10, ++i, i += 5);
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(y,
-                                                      "for (int i = 0; (i < 10); ++i) (i += 5);"));
+    EXPECT_EQUAL(y, "for (int i = 0; (i < 10); ++i) (i += 5);");
 
     {
         ExpectError error(r, "error: expected 'bool', but found 'int'\n");
@@ -1020,8 +1024,8 @@
         sk_FragColor() = Half4(coords, 0, 1)
     );
     REPORTER_ASSERT(r, DSLWriter::ProgramElements().size() == 1);
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(*DSLWriter::ProgramElements()[0],
-            "void main(half2 coords) { (sk_FragColor = half4(coords, 0.0, 1.0)); }"));
+    EXPECT_EQUAL(*DSLWriter::ProgramElements()[0],
+                 "void main(half2 coords) { (sk_FragColor = half4(coords, 0.0, 1.0)); }");
 
     DSLWriter::ProgramElements().clear();
     Var x(kFloat, "x");
@@ -1029,8 +1033,7 @@
         Return(x * x)
     );
     REPORTER_ASSERT(r, DSLWriter::ProgramElements().size() == 1);
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(*DSLWriter::ProgramElements()[0],
-            "float sqr(float x) { return (x * x); }"));
+    EXPECT_EQUAL(*DSLWriter::ProgramElements()[0], "float sqr(float x) { return (x * x); }");
 
     {
         ExpectError error(r, "error: expected 'float', but found 'bool'\n");
@@ -1070,10 +1073,10 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kFloat, "a"), b(kFloat, "b");
     Statement x = If(a > b, a -= b);
-    REPORTER_ASSERT(r, x.release()->description() == "if ((a > b)) (a -= b);");
+    EXPECT_EQUAL(x, "if ((a > b)) (a -= b);");
 
     Statement y = If(a > b, a -= b, b -= a);
-    REPORTER_ASSERT(r, y.release()->description() == "if ((a > b)) (a -= b); else (b -= a);");
+    EXPECT_EQUAL(y, "if ((a > b)) (a -= b); else (b -= a);");
 
     {
         ExpectError error(r, "error: expected 'bool', but found 'float'\n");
@@ -1085,17 +1088,17 @@
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
 
     Statement x = Return();
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(x, "return;"));
+    EXPECT_EQUAL(x, "return;");
 
     Statement y = Return(true);
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(y, "return true;"));
+    EXPECT_EQUAL(y, "return true;");
 }
 
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLSelect, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(kInt, "a");
     Expression x = Select(a > 0, 1, -1);
-    REPORTER_ASSERT(r, x.release()->description() == "((a > 0) ? 1 : -1)");
+    EXPECT_EQUAL(x, "((a > 0) ? 1 : -1)");
 
     {
         ExpectError error(r, "error: expected 'bool', but found 'int'\n");
@@ -1118,16 +1121,14 @@
         Case(1, a = 1, Continue()),
         Default(Discard())
     );
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(x,
-        "switch (5) { case 0: (a = 0.0); break; case 1: (a = 1.0); continue; default: discard; }"));
+    EXPECT_EQUAL(x,
+        "switch (5) { case 0: (a = 0.0); break; case 1: (a = 1.0); continue; default: discard; }");
 
     Statement y = Switch(b);
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(y,
-        "switch (b) {}"));
+    EXPECT_EQUAL(y, "switch (b) {}");
 
     Statement z = Switch(b, Default(), Case(0), Case(1));
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(z,
-        "switch (b) { default: case 0: case 1: }"));
+    EXPECT_EQUAL(z, "switch (b) { default: case 0: case 1: }");
 
     {
         ExpectError error(r, "error: duplicate case value\n");
@@ -1157,53 +1158,53 @@
     Var a(kFloat4, "a");
 
     Expression e1 = a.x();
-    REPORTER_ASSERT(r, e1.release()->description() == "a.x");
+    EXPECT_EQUAL(e1, "a.x");
 
     Expression e2 = a.y();
-    REPORTER_ASSERT(r, e2.release()->description() == "a.y");
+    EXPECT_EQUAL(e2, "a.y");
 
     Expression e3 = a.z();
-    REPORTER_ASSERT(r, e3.release()->description() == "a.z");
+    EXPECT_EQUAL(e3, "a.z");
 
     Expression e4 = a.w();
-    REPORTER_ASSERT(r, e4.release()->description() == "a.w");
+    EXPECT_EQUAL(e4, "a.w");
 
     Expression e5 = a.r();
-    REPORTER_ASSERT(r, e5.release()->description() == "a.x");
+    EXPECT_EQUAL(e5, "a.x");
 
     Expression e6 = a.g();
-    REPORTER_ASSERT(r, e6.release()->description() == "a.y");
+    EXPECT_EQUAL(e6, "a.y");
 
     Expression e7 = a.b();
-    REPORTER_ASSERT(r, e7.release()->description() == "a.z");
+    EXPECT_EQUAL(e7, "a.z");
 
     Expression e8 = a.a();
-    REPORTER_ASSERT(r, e8.release()->description() == "a.w");
+    EXPECT_EQUAL(e8, "a.w");
 
     Expression e9 = Swizzle(a, R);
-    REPORTER_ASSERT(r, e9.release()->description() == "a.x");
+    EXPECT_EQUAL(e9, "a.x");
 
     Expression e10 = Swizzle(a, ZERO, G);
-    REPORTER_ASSERT(r, e10.release()->description() == "float2(a.y, float(0)).yx");
+    EXPECT_EQUAL(e10, "float2(a.y, float(0)).yx");
 
     Expression e11 = Swizzle(a, B, G, G);
-    REPORTER_ASSERT(r, e11.release()->description() == "a.zyy");
+    EXPECT_EQUAL(e11, "a.zyy");
 
     Expression e12 = Swizzle(a, R, G, B, ONE);
-    REPORTER_ASSERT(r, e12.release()->description() == "float4(a.xyz, float(1))");
+    EXPECT_EQUAL(e12, "float4(a.xyz, float(1))");
 
     Expression e13 = Swizzle(a, R, G, B, ONE).r();
-    REPORTER_ASSERT(r, e13.release()->description() == "float4(a.xyz, float(1)).x");
+    EXPECT_EQUAL(e13, "float4(a.xyz, float(1)).x");
 }
 
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLWhile, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Statement x = While(true, Block());
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(x, "for (; true;) {}"));
+    EXPECT_EQUAL(x, "for (; true;) {}");
 
     Var a(kFloat, "a"), b(kFloat, "b");
     Statement y = While(a != b, Block(a++, --b));
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(y, "for (; (a != b);) { a++; --b; }"));
+    EXPECT_EQUAL(y, "for (; (a != b);) { a++; --b; }");
 
     {
         ExpectError error(r, "error: expected 'bool', but found 'int'\n");
@@ -1214,10 +1215,9 @@
 DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLIndex, r, ctxInfo) {
     AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
     Var a(Array(kInt, 5), "a"), b(kInt, "b");
-    Expression e1 = a[0];
-    REPORTER_ASSERT(r, e1.release()->description() == "a[0]");
-    Expression e2 = a[b];
-    REPORTER_ASSERT(r, e2.release()->description() == "a[b]");
+
+    EXPECT_EQUAL(a[0], "a[0]");
+    EXPECT_EQUAL(a[b], "a[b]");
 
     {
         ExpectError error(r, "error: expected 'int', but found 'bool'\n");
@@ -1242,48 +1242,48 @@
     Var a(kHalf4, "a"), b(kHalf4, "b"), c(kHalf4, "c");
     Var h3(kHalf3, "h3");
     Var b4(kBool4, "b4");
-    REPORTER_ASSERT(r, Abs(a).release()->description()                 == "abs(a)");
-    REPORTER_ASSERT(r, All(b4).release()->description()                == "all(b4)");
-    REPORTER_ASSERT(r, Any(b4).release()->description()                == "any(b4)");
-    REPORTER_ASSERT(r, Ceil(a).release()->description()                == "ceil(a)");
-    REPORTER_ASSERT(r, Clamp(a, 0, 1).release()->description()         == "clamp(a, 0.0, 1.0)");
-    REPORTER_ASSERT(r, Cos(a).release()->description()                 == "cos(a)");
-    REPORTER_ASSERT(r, Cross(h3, h3).release()->description()          == "cross(h3, h3)");
-    REPORTER_ASSERT(r, Degrees(a).release()->description()             == "degrees(a)");
-    REPORTER_ASSERT(r, Distance(a, b).release()->description()         == "distance(a, b)");
-    REPORTER_ASSERT(r, Dot(a, b).release()->description()              == "dot(a, b)");
-    REPORTER_ASSERT(r, Equal(a, b).release()->description()            == "equal(a, b)");
-    REPORTER_ASSERT(r, Exp(a).release()->description()                 == "exp(a)");
-    REPORTER_ASSERT(r, Exp2(a).release()->description()                == "exp2(a)");
-    REPORTER_ASSERT(r, Faceforward(a, b, c).release()->description()   == "faceforward(a, b, c)");
-    REPORTER_ASSERT(r, Floor(a).release()->description()               == "floor(a)");
-    REPORTER_ASSERT(r, Fract(a).release()->description()               == "fract(a)");
-    REPORTER_ASSERT(r, GreaterThan(a, b).release()->description()      == "greaterThan(a, b)");
-    REPORTER_ASSERT(r, GreaterThanEqual(a, b).release()->description() == "greaterThanEqual(a, b)");
-    REPORTER_ASSERT(r, Inversesqrt(a).release()->description()         == "inversesqrt(a)");
-    REPORTER_ASSERT(r, LessThan(a, b).release()->description()         == "lessThan(a, b)");
-    REPORTER_ASSERT(r, LessThanEqual(a, b).release()->description()    == "lessThanEqual(a, b)");
-    REPORTER_ASSERT(r, Length(a).release()->description()              == "length(a)");
-    REPORTER_ASSERT(r, Log(a).release()->description()                 == "log(a)");
-    REPORTER_ASSERT(r, Log2(a).release()->description()                == "log2(a)");
-    REPORTER_ASSERT(r, Max(a, b).release()->description()              == "max(a, b)");
-    REPORTER_ASSERT(r, Min(a, b).release()->description()              == "min(a, b)");
-    REPORTER_ASSERT(r, Mix(a, b, c).release()->description()           == "mix(a, b, c)");
-    REPORTER_ASSERT(r, Mod(a, b).release()->description()              == "mod(a, b)");
-    REPORTER_ASSERT(r, Normalize(a).release()->description()           == "normalize(a)");
-    REPORTER_ASSERT(r, NotEqual(a, b).release()->description()         == "notEqual(a, b)");
-    REPORTER_ASSERT(r, Pow(a, b).release()->description()              == "pow(a, b)");
-    REPORTER_ASSERT(r, Radians(a).release()->description()             == "radians(a)");
-    REPORTER_ASSERT(r, Reflect(a, b).release()->description()          == "reflect(a, b)");
-    REPORTER_ASSERT(r, Refract(a, b, 1).release()->description()       == "refract(a, b, 1.0)");
-    REPORTER_ASSERT(r, Saturate(a).release()->description()            == "saturate(a)");
-    REPORTER_ASSERT(r, Sign(a).release()->description()                == "sign(a)");
-    REPORTER_ASSERT(r, Sin(a).release()->description()                 == "sin(a)");
-    REPORTER_ASSERT(r, Smoothstep(a, b, c).release()->description()    == "smoothstep(a, b, c)");
-    REPORTER_ASSERT(r, Sqrt(a).release()->description()                == "sqrt(a)");
-    REPORTER_ASSERT(r, Step(a, b).release()->description()             == "step(a, b)");
-    REPORTER_ASSERT(r, Tan(a).release()->description()                 == "tan(a)");
-    REPORTER_ASSERT(r, Unpremul(a).release()->description()            == "unpremul(a)");
+    EXPECT_EQUAL(Abs(a),                 "abs(a)");
+    EXPECT_EQUAL(All(b4),                "all(b4)");
+    EXPECT_EQUAL(Any(b4),                "any(b4)");
+    EXPECT_EQUAL(Ceil(a),                "ceil(a)");
+    EXPECT_EQUAL(Clamp(a, 0, 1),         "clamp(a, 0.0, 1.0)");
+    EXPECT_EQUAL(Cos(a),                 "cos(a)");
+    EXPECT_EQUAL(Cross(h3, h3),          "cross(h3, h3)");
+    EXPECT_EQUAL(Degrees(a),             "degrees(a)");
+    EXPECT_EQUAL(Distance(a, b),         "distance(a, b)");
+    EXPECT_EQUAL(Dot(a, b),              "dot(a, b)");
+    EXPECT_EQUAL(Equal(a, b),            "equal(a, b)");
+    EXPECT_EQUAL(Exp(a),                 "exp(a)");
+    EXPECT_EQUAL(Exp2(a),                "exp2(a)");
+    EXPECT_EQUAL(Faceforward(a, b, c),   "faceforward(a, b, c)");
+    EXPECT_EQUAL(Floor(a),               "floor(a)");
+    EXPECT_EQUAL(Fract(a),               "fract(a)");
+    EXPECT_EQUAL(GreaterThan(a, b),      "greaterThan(a, b)");
+    EXPECT_EQUAL(GreaterThanEqual(a, b), "greaterThanEqual(a, b)");
+    EXPECT_EQUAL(Inversesqrt(a),         "inversesqrt(a)");
+    EXPECT_EQUAL(LessThan(a, b),         "lessThan(a, b)");
+    EXPECT_EQUAL(LessThanEqual(a, b),    "lessThanEqual(a, b)");
+    EXPECT_EQUAL(Length(a),              "length(a)");
+    EXPECT_EQUAL(Log(a),                 "log(a)");
+    EXPECT_EQUAL(Log2(a),                "log2(a)");
+    EXPECT_EQUAL(Max(a, b),              "max(a, b)");
+    EXPECT_EQUAL(Min(a, b),              "min(a, b)");
+    EXPECT_EQUAL(Mix(a, b, c),           "mix(a, b, c)");
+    EXPECT_EQUAL(Mod(a, b),              "mod(a, b)");
+    EXPECT_EQUAL(Normalize(a),           "normalize(a)");
+    EXPECT_EQUAL(NotEqual(a, b),         "notEqual(a, b)");
+    EXPECT_EQUAL(Pow(a, b),              "pow(a, b)");
+    EXPECT_EQUAL(Radians(a),             "radians(a)");
+    EXPECT_EQUAL(Reflect(a, b),          "reflect(a, b)");
+    EXPECT_EQUAL(Refract(a, b, 1),       "refract(a, b, 1.0)");
+    EXPECT_EQUAL(Saturate(a),            "saturate(a)");
+    EXPECT_EQUAL(Sign(a),                "sign(a)");
+    EXPECT_EQUAL(Sin(a),                 "sin(a)");
+    EXPECT_EQUAL(Smoothstep(a, b, c),    "smoothstep(a, b, c)");
+    EXPECT_EQUAL(Sqrt(a),                "sqrt(a)");
+    EXPECT_EQUAL(Step(a, b),             "step(a, b)");
+    EXPECT_EQUAL(Tan(a),                 "tan(a)");
+    EXPECT_EQUAL(Unpremul(a),            "unpremul(a)");
 
     // these calls all go through the normal channels, so it ought to be sufficient to prove that
     // one of them reports errors correctly
@@ -1298,7 +1298,7 @@
 
     Var v1(kConst_Modifier, kInt, "v1");
     Statement d1 = Declare(v1);
-    REPORTER_ASSERT(r, d1.release()->description() == "const int v1;");
+    EXPECT_EQUAL(d1, "const int v1;");
 
     // Most modifiers require an appropriate context to be legal. We can't yet give them that
     // context, so we can't as yet Declare() variables with these modifiers.
@@ -1345,11 +1345,11 @@
         Return(result)
     );
     REPORTER_ASSERT(r, DSLWriter::ProgramElements().size() == 2);
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(*DSLWriter::ProgramElements()[0],
-            "struct SimpleStruct { float x; bool b; float[3] a; };"));
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(*DSLWriter::ProgramElements()[1],
-            "SimpleStruct returnStruct() { SimpleStruct result; (result.x = 123.0);"
-            "(result.b = (result.x > 0.0)); (result.a[0] = result.x); return result; }"));
+    EXPECT_EQUAL(*DSLWriter::ProgramElements()[0],
+                 "struct SimpleStruct { float x; bool b; float[3] a; };");
+    EXPECT_EQUAL(*DSLWriter::ProgramElements()[1],
+                 "SimpleStruct returnStruct() { SimpleStruct result; (result.x = 123.0);"
+                 "(result.b = (result.x > 0.0)); (result.a[0] = result.x); return result; }");
 
     DSLWriter::ProgramElements().clear();
     Struct("NestedStruct",
@@ -1357,6 +1357,6 @@
         Field(simpleStruct, "simple")
     );
     REPORTER_ASSERT(r, DSLWriter::ProgramElements().size() == 1);
-    REPORTER_ASSERT(r, whitespace_insensitive_compare(*DSLWriter::ProgramElements()[0],
-            "struct NestedStruct { int x; SimpleStruct simple; };"));
+    EXPECT_EQUAL(*DSLWriter::ProgramElements()[0],
+                 "struct NestedStruct { int x; SimpleStruct simple; };");
 }