Cycles: Cleanup, order of arguments to EXPECT_EQ
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 3 Feb 2017 10:35:34 +0000 (11:35 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 3 Feb 2017 10:35:34 +0000 (11:35 +0100)
The order was wrong from the semantic point of view, caused
by some legacy workarounds in Libmv. Didn't realize it's was
not how things were expected to be used.

intern/cycles/test/render_graph_finalize_test.cpp
intern/cycles/test/util_aligned_malloc_test.cpp
intern/cycles/test/util_path_test.cpp
intern/cycles/test/util_string_test.cpp

index 32b4c7265ee1453d3912771a2d040f6670158a55..3fc086cbc0c50a4bf51d48a28c3d7f1affdff454 100644 (file)
@@ -92,7 +92,7 @@ public:
        template<typename T>
        ShaderGraphBuilder& add_node(const T& node)
        {
-               EXPECT_EQ(NULL, find_node(node.name()));
+               EXPECT_EQ(find_node(node.name()), (void*)NULL);
                graph_->add(node.node());
                node_map_[node.name()] = node.node();
                return *this;
@@ -104,8 +104,8 @@ public:
                vector<string> tokens_from, tokens_to;
                string_split(tokens_from, from, "::");
                string_split(tokens_to, to, "::");
-               EXPECT_EQ(2, tokens_from.size());
-               EXPECT_EQ(2, tokens_to.size());
+               EXPECT_EQ(tokens_from.size(), 2);
+               EXPECT_EQ(tokens_to.size(), 2);
                ShaderNode *node_from = find_node(tokens_from[0]),
                           *node_to = find_node(tokens_to[0]);
                EXPECT_NE((void*)NULL, node_from);
index 479070f0513f382a594dbcae1c2618a75e891110..9fb3aad0c3fa95cd06cf5f64dd0b4baf7cca2b48 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "util/util_aligned_malloc.h"
 
-#define CHECK_ALIGNMENT(ptr, align) EXPECT_EQ(0, (size_t)ptr % align)
+#define CHECK_ALIGNMENT(ptr, align) EXPECT_EQ((size_t)ptr % align, 0)
 
 CCL_NAMESPACE_BEGIN
 
index 92be1dd4cbe5ca4fa2382800c4bac8bd55fadd82..c2f400c105d1da9e2dcbcfa802717849e774136f 100644 (file)
@@ -26,63 +26,63 @@ CCL_NAMESPACE_BEGIN
 TEST(util_path_filename, simple_unix)
 {
        string str = path_filename("/tmp/foo.txt");
-       EXPECT_EQ("foo.txt", str);
+       EXPECT_EQ(str, "foo.txt");
 }
 
 TEST(util_path_filename, root_unix)
 {
        string str = path_filename("/");
-       EXPECT_EQ("/", str);
+       EXPECT_EQ(str, "/");
 }
 
 TEST(util_path_filename, last_slash_unix)
 {
        string str = path_filename("/tmp/foo.txt/");
-       EXPECT_EQ(".", str);
+       EXPECT_EQ(str, ".");
 }
 
 TEST(util_path_filename, alternate_slash_unix)
 {
        string str = path_filename("/tmp\\foo.txt");
-       EXPECT_EQ("tmp\\foo.txt", str);
+       EXPECT_EQ(str, "tmp\\foo.txt");
 }
 #endif  /* !_WIN32 */
 
 TEST(util_path_filename, file_only)
 {
        string str = path_filename("foo.txt");
-       EXPECT_EQ("foo.txt", str);
+       EXPECT_EQ(str, "foo.txt");
 }
 
 TEST(util_path_filename, empty)
 {
        string str = path_filename("");
-       EXPECT_EQ("", str);
+       EXPECT_EQ(str, "");
 }
 
 #ifdef _WIN32
 TEST(util_path_filename, simple_windows)
 {
        string str = path_filename("C:\\tmp\\foo.txt");
-       EXPECT_EQ("foo.txt", str);
+       EXPECT_EQ(str, "foo.txt");
 }
 
 TEST(util_path_filename, root_windows)
 {
        string str = path_filename("C:\\");
-       EXPECT_EQ("\\", str);
+       EXPECT_EQ(str, "\\");
 }
 
 TEST(util_path_filename, last_slash_windows)
 {
        string str = path_filename("C:\\tmp\\foo.txt\\");
-       EXPECT_EQ(".", str);
+       EXPECT_EQ(str, ".");
 }
 
 TEST(util_path_filename, alternate_slash_windows)
 {
        string str = path_filename("C:\\tmp/foo.txt");
-       EXPECT_EQ("foo.txt", str);
+       EXPECT_EQ(str, "foo.txt");
 }
 #endif  /* _WIN32 */
 
@@ -92,63 +92,63 @@ TEST(util_path_filename, alternate_slash_windows)
 TEST(util_path_dirname, simple_unix)
 {
        string str = path_dirname("/tmp/foo.txt");
-       EXPECT_EQ("/tmp", str);
+       EXPECT_EQ(str, "/tmp");
 }
 
 TEST(util_path_dirname, root_unix)
 {
        string str = path_dirname("/");
-       EXPECT_EQ("", str);
+       EXPECT_EQ(str, "");
 }
 
 TEST(util_path_dirname, last_slash_unix)
 {
        string str = path_dirname("/tmp/foo.txt/");
-       EXPECT_EQ("/tmp/foo.txt", str);
+       EXPECT_EQ(str, "/tmp/foo.txt");
 }
 
 TEST(util_path_dirname, alternate_slash_unix)
 {
        string str = path_dirname("/tmp\\foo.txt");
-       EXPECT_EQ("/", str);
+       EXPECT_EQ(str, "/");
 }
 #endif  /* !_WIN32 */
 
 TEST(util_path_dirname, file_only)
 {
        string str = path_dirname("foo.txt");
-       EXPECT_EQ("", str);
+       EXPECT_EQ(str, "");
 }
 
 TEST(util_path_dirname, empty)
 {
        string str = path_dirname("");
-       EXPECT_EQ("", str);
+       EXPECT_EQ(str, "");
 }
 
 #ifdef _WIN32
 TEST(util_path_dirname, simple_windows)
 {
        string str = path_dirname("C:\\tmp\\foo.txt");
-       EXPECT_EQ("C:\\tmp", str);
+       EXPECT_EQ(str, "C:\\tmp");
 }
 
 TEST(util_path_dirname, root_windows)
 {
        string str = path_dirname("C:\\");
-       EXPECT_EQ("C:", str);
+       EXPECT_EQ(str, "C:");
 }
 
 TEST(util_path_dirname, last_slash_windows)
 {
        string str = path_dirname("C:\\tmp\\foo.txt\\");
-       EXPECT_EQ("C:\\tmp\\foo.txt", str);
+       EXPECT_EQ(str, "C:\\tmp\\foo.txt");
 }
 
 TEST(util_path_dirname, alternate_slash_windows)
 {
        string str = path_dirname("C:\\tmp/foo.txt");
-       EXPECT_EQ("C:\\tmp", str);
+       EXPECT_EQ(str, "C:\\tmp");
 }
 #endif  /* _WIN32 */
 
@@ -157,152 +157,152 @@ TEST(util_path_dirname, alternate_slash_windows)
 TEST(util_path_join, empty_both)
 {
        string str = path_join("", "");
-       EXPECT_EQ("", str);
+       EXPECT_EQ(str, "");
 }
 
 TEST(util_path_join, empty_directory)
 {
        string str = path_join("", "foo.txt");
-       EXPECT_EQ("foo.txt", str);
+       EXPECT_EQ(str, "foo.txt");
 }
 
 TEST(util_path_join, empty_filename)
 {
        string str = path_join("foo", "");
-       EXPECT_EQ("foo", str);
+       EXPECT_EQ(str, "foo");
 }
 
 #ifndef _WIN32
 TEST(util_path_join, simple_unix)
 {
        string str = path_join("foo", "bar");
-       EXPECT_EQ("foo/bar", str);
+       EXPECT_EQ(str, "foo/bar");
 }
 
 TEST(util_path_join, directory_slash_unix)
 {
        string str = path_join("foo/", "bar");
-       EXPECT_EQ("foo/bar", str);
+       EXPECT_EQ(str, "foo/bar");
 }
 
 TEST(util_path_join, filename_slash_unix)
 {
        string str = path_join("foo", "/bar");
-       EXPECT_EQ("foo/bar", str);
+       EXPECT_EQ(str, "foo/bar");
 }
 
 TEST(util_path_join, both_slash_unix)
 {
        string str = path_join("foo/", "/bar");
-       EXPECT_EQ("foo//bar", str);
+       EXPECT_EQ(str, "foo//bar");
 }
 
 TEST(util_path_join, directory_alternate_slash_unix)
 {
        string str = path_join("foo\\", "bar");
-       EXPECT_EQ("foo\\/bar", str);
+       EXPECT_EQ(str, "foo\\/bar");
 }
 
 TEST(util_path_join, filename_alternate_slash_unix)
 {
        string str = path_join("foo", "\\bar");
-       EXPECT_EQ("foo/\\bar", str);
+       EXPECT_EQ(str, "foo/\\bar");
 }
 
 TEST(util_path_join, both_alternate_slash_unix)
 {
        string str = path_join("foo", "\\bar");
-       EXPECT_EQ("foo/\\bar", str);
+       EXPECT_EQ(str, "foo/\\bar");
 }
 
 TEST(util_path_join, empty_dir_filename_slash_unix)
 {
        string str = path_join("", "/foo.txt");
-       EXPECT_EQ("/foo.txt", str);
+       EXPECT_EQ(str, "/foo.txt");
 }
 
 TEST(util_path_join, empty_dir_filename_alternate_slash_unix)
 {
        string str = path_join("", "\\foo.txt");
-       EXPECT_EQ("\\foo.txt", str);
+       EXPECT_EQ(str, "\\foo.txt");
 }
 
 TEST(util_path_join, empty_filename_dir_slash_unix)
 {
        string str = path_join("foo/", "");
-       EXPECT_EQ("foo/", str);
+       EXPECT_EQ(str, "foo/");
 }
 
 TEST(util_path_join, empty_filename_dir_alternate_slash_unix)
 {
        string str = path_join("foo\\", "");
-       EXPECT_EQ("foo\\", str);
+       EXPECT_EQ(str, "foo\\");
 }
 #else  /* !_WIN32 */
 TEST(util_path_join, simple_windows)
 {
        string str = path_join("foo", "bar");
-       EXPECT_EQ("foo\\bar", str);
+       EXPECT_EQ(str, "foo\\bar");
 }
 
 TEST(util_path_join, directory_slash_windows)
 {
        string str = path_join("foo\\", "bar");
-       EXPECT_EQ("foo\\bar", str);
+       EXPECT_EQ(str, "foo\\bar");
 }
 
 TEST(util_path_join, filename_slash_windows)
 {
        string str = path_join("foo", "\\bar");
-       EXPECT_EQ("foo\\bar", str);
+       EXPECT_EQ(str, "foo\\bar");
 }
 
 TEST(util_path_join, both_slash_windows)
 {
        string str = path_join("foo\\", "\\bar");
-       EXPECT_EQ("foo\\\\bar", str);
+       EXPECT_EQ(str, "foo\\\\bar");
 }
 
 TEST(util_path_join, directory_alternate_slash_windows)
 {
        string str = path_join("foo/", "bar");
-       EXPECT_EQ("foo/bar", str);
+       EXPECT_EQ(str, "foo/bar");
 }
 
 TEST(util_path_join, filename_alternate_slash_windows)
 {
        string str = path_join("foo", "/bar");
-       EXPECT_EQ("foo/bar", str);
+       EXPECT_EQ(str, "foo/bar");
 }
 
 TEST(util_path_join, both_alternate_slash_windows)
 {
        string str = path_join("foo/", "/bar");
-       EXPECT_EQ("foo//bar", str);
+       EXPECT_EQ(str, "foo//bar");
 }
 
 TEST(util_path_join, empty_dir_filename_slash_windows)
 {
        string str = path_join("", "\\foo.txt");
-       EXPECT_EQ("\\foo.txt", str);
+       EXPECT_EQ(str, "\\foo.txt");
 }
 
 TEST(util_path_join, empty_dir_filename_alternate_slash_windows)
 {
        string str = path_join("", "/foo.txt");
-       EXPECT_EQ("/foo.txt", str);
+       EXPECT_EQ(str, "/foo.txt");
 }
 
 TEST(util_path_join, empty_filename_dir_slash_windows)
 {
        string str = path_join("foo\\", "");
-       EXPECT_EQ("foo\\", str);
+       EXPECT_EQ(str, "foo\\");
 }
 
 TEST(util_path_join, empty_filename_dir_alternate_slash_windows)
 {
        string str = path_join("foo/", "");
-       EXPECT_EQ("foo/", str);
+       EXPECT_EQ(str, "foo/");
 }
 #endif  /* !_WIN32 */
 
@@ -311,31 +311,31 @@ TEST(util_path_join, empty_filename_dir_alternate_slash_windows)
 TEST(util_path_escape, no_escape_chars)
 {
        string str = path_escape("/tmp/foo/bar");
-       EXPECT_EQ("/tmp/foo/bar", str);
+       EXPECT_EQ(str, "/tmp/foo/bar");
 }
 
 TEST(util_path_escape, simple)
 {
        string str = path_escape("/tmp/foo bar");
-       EXPECT_EQ("/tmp/foo\\ bar", str);
+       EXPECT_EQ(str, "/tmp/foo\\ bar");
 }
 
 TEST(util_path_escape, simple_end)
 {
        string str = path_escape("/tmp/foo/bar ");
-       EXPECT_EQ("/tmp/foo/bar\\ ", str);
+       EXPECT_EQ(str, "/tmp/foo/bar\\ ");
 }
 
 TEST(util_path_escape, multiple)
 {
        string str = path_escape("/tmp/foo  bar");
-       EXPECT_EQ("/tmp/foo\\ \\ bar", str);
+       EXPECT_EQ(str, "/tmp/foo\\ \\ bar");
 }
 
 TEST(util_path_escape, simple_multiple_end)
 {
        string str = path_escape("/tmp/foo/bar  ");
-       EXPECT_EQ("/tmp/foo/bar\\ \\ ", str);
+       EXPECT_EQ(str, "/tmp/foo/bar\\ \\ ");
 }
 
 /* ******** Tests for path_is_relative() ******** */
index e502a35704b7bc28c9ca2ce1ef6f87bafc8a95d8..22ec8e0ee8e3b494b715212d538ebf1af6625090 100644 (file)
@@ -25,25 +25,25 @@ CCL_NAMESPACE_BEGIN
 TEST(util_string_printf, no_format)
 {
        string str = string_printf("foo bar");
-       EXPECT_EQ(str, "foo bar");
+       EXPECT_EQ("foo bar", str);
 }
 
 TEST(util_string_printf, int_number)
 {
        string str = string_printf("foo %d bar", 314);
-       EXPECT_EQ(str, "foo 314 bar");
+       EXPECT_EQ("foo 314 bar", str);
 }
 
 TEST(util_string_printf, float_number_default_precision)
 {
        string str = string_printf("foo %f bar", 3.1415);
-       EXPECT_EQ(str, "foo 3.141500 bar");
+       EXPECT_EQ("foo 3.141500 bar", str);
 }
 
 TEST(util_string_printf, float_number_custom_precision)
 {
        string str = string_printf("foo %.1f bar", 3.1415);
-       EXPECT_EQ(str, "foo 3.1 bar");
+       EXPECT_EQ("foo 3.1 bar", str);
 }
 
 /* ******** Tests for string_printf() ******** */
@@ -78,44 +78,44 @@ TEST(util_string_split, empty)
 {
        vector<string> tokens;
        string_split(tokens, "");
-       EXPECT_EQ(0, tokens.size());
+       EXPECT_EQ(tokens.size(), 0);
 }
 
 TEST(util_string_split, only_spaces)
 {
        vector<string> tokens;
        string_split(tokens, "   \t\t \t");
-       EXPECT_EQ(0, tokens.size());
+       EXPECT_EQ(tokens.size(), 0);
 }
 
 TEST(util_string_split, single)
 {
        vector<string> tokens;
        string_split(tokens, "foo");
-       EXPECT_EQ(1, tokens.size());
-       EXPECT_EQ("foo", tokens[0]);
+       EXPECT_EQ(tokens.size(), 1);
+       EXPECT_EQ(tokens[0], "foo");
 }
 
 TEST(util_string_split, simple)
 {
        vector<string> tokens;
        string_split(tokens, "foo a bar b");
-       EXPECT_EQ(4, tokens.size());
-       EXPECT_EQ("foo", tokens[0]);
-       EXPECT_EQ("a", tokens[1]);
-       EXPECT_EQ("bar", tokens[2]);
-       EXPECT_EQ("b", tokens[3]);
+       EXPECT_EQ(tokens.size(), 4);
+       EXPECT_EQ(tokens[0], "foo");
+       EXPECT_EQ(tokens[1], "a");
+       EXPECT_EQ(tokens[2], "bar");
+       EXPECT_EQ(tokens[3], "b");
 }
 
 TEST(util_string_split, multiple_spaces)
 {
        vector<string> tokens;
        string_split(tokens, " \t foo \ta bar b\t  ");
-       EXPECT_EQ(4, tokens.size());
-       EXPECT_EQ("foo", tokens[0]);
-       EXPECT_EQ("a", tokens[1]);
-       EXPECT_EQ("bar", tokens[2]);
-       EXPECT_EQ("b", tokens[3]);
+       EXPECT_EQ(tokens.size(), 4);
+       EXPECT_EQ(tokens[0], "foo");
+       EXPECT_EQ(tokens[1], "a");
+       EXPECT_EQ(tokens[2], "bar");
+       EXPECT_EQ(tokens[3], "b");
 }
 
 /* ******** Tests for string_replace() ******** */
@@ -124,35 +124,35 @@ TEST(util_string_replace, empty_haystack_and_other)
 {
        string str = "";
        string_replace(str, "x", "");
-       EXPECT_EQ("", str);
+       EXPECT_EQ(str, "");
 }
 
 TEST(util_string_replace, empty_haystack)
 {
        string str = "";
        string_replace(str, "x", "y");
-       EXPECT_EQ("", str);
+       EXPECT_EQ(str, "");
 }
 
 TEST(util_string_replace, empty_other)
 {
        string str = "x";
        string_replace(str, "x", "");
-       EXPECT_EQ("", str);
+       EXPECT_EQ(str, "");
 }
 
 TEST(util_string_replace, long_haystack_empty_other)
 {
        string str = "a x b xxc";
        string_replace(str, "x", "");
-       EXPECT_EQ("a  b c", str);
+       EXPECT_EQ(str, "a  b c");
 }
 
 TEST(util_string_replace, long_haystack)
 {
        string str = "a x b xxc";
        string_replace(str, "x", "FOO");
-       EXPECT_EQ("a FOO b FOOFOOc", str);
+       EXPECT_EQ(str, "a FOO b FOOFOOc");
 }
 
 /* ******** Tests for string_endswith() ******** */
@@ -192,25 +192,25 @@ TEST(util_string_endswith, simple_false)
 TEST(util_string_strip, empty)
 {
        string str = string_strip("");
-       EXPECT_EQ("", str);
+       EXPECT_EQ(str, "");
 }
 
 TEST(util_string_strip, only_spaces)
 {
        string str = string_strip("      ");
-       EXPECT_EQ("", str);
+       EXPECT_EQ(str, "");
 }
 
 TEST(util_string_strip, no_spaces)
 {
        string str = string_strip("foo bar");
-       EXPECT_EQ("foo bar", str);
+       EXPECT_EQ(str, "foo bar");
 }
 
 TEST(util_string_strip, with_spaces)
 {
        string str = string_strip("    foo bar ");
-       EXPECT_EQ("foo bar", str);
+       EXPECT_EQ(str, "foo bar");
 }
 
 /* ******** Tests for string_remove_trademark() ******** */
@@ -218,31 +218,31 @@ TEST(util_string_strip, with_spaces)
 TEST(util_string_remove_trademark, empty)
 {
        string str = string_remove_trademark("");
-       EXPECT_EQ("", str);
+       EXPECT_EQ(str, "");
 }
 
 TEST(util_string_remove_trademark, no_trademark)
 {
        string str = string_remove_trademark("foo bar");
-       EXPECT_EQ("foo bar", str);
+       EXPECT_EQ(str, "foo bar");
 }
 
 TEST(util_string_remove_trademark, only_tm)
 {
        string str = string_remove_trademark("foo bar(TM) zzz");
-       EXPECT_EQ("foo bar zzz", str);
+       EXPECT_EQ(str, "foo bar zzz");
 }
 
 TEST(util_string_remove_trademark, only_r)
 {
        string str = string_remove_trademark("foo bar(R) zzz");
-       EXPECT_EQ("foo bar zzz", str);
+       EXPECT_EQ(str, "foo bar zzz");
 }
 
 TEST(util_string_remove_trademark, both)
 {
        string str = string_remove_trademark("foo bar(TM)(R) zzz");
-       EXPECT_EQ("foo bar zzz", str);
+       EXPECT_EQ(str, "foo bar zzz");
 }
 
 CCL_NAMESPACE_END