Adding support for testing BUILD.gn
BUG=tint:50
Change-Id: Ie19a1af6a97a49a67dcc7474991c960b986ddebe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19782
Reviewed-by: David Neto <dneto@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index a3b566b..04bf5dc 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -13,12 +13,14 @@
# limitations under the License.
import("//build_overrides/build.gni")
+import("//testing/test.gni")
import("tint_overrides_with_defaults.gni")
+###############################################################################
+# Common - Configs, etc. shared across targets
+###############################################################################
+
config("tint_common_config") {
- cflags = []
- ldflags = []
- include_dirs = []
defines = []
if (tint_build_spv_reader) {
@@ -46,15 +48,20 @@
}
}
-# libtint source sets are divided into a non-optional core in :libtint_core and
-# optional :libtint_* subsets, because ninja does not like having multiple source
-# files with the same name, like function.cc, in the same source set target.
+###############################################################################
+# Library - Tint core and optional modules of libtint
+###############################################################################
+# libtint source sets are divided into a non-optional core in :libtint_core_src
+# and optional :libtint_*_src subsets, because ninja does not like having
+# multiple source files with the same name, like function.cc, in the same
+# source set
+# target.
#
-# Targets that want to use tint as a library should depend on ":libtint" and use
-# the build flags to control what is included, instead of trying to specify the
-# subsets that they want.
+# Targets that want to use tint as a library should depend on ":libtint" and
+# use the build flags to control what is included, instead of trying to specify
+# the subsets that they want.
-source_set("libtint_core") {
+source_set("libtint_core_src") {
sources = [
"src/ast/array_accessor_expression.cc",
"src/ast/array_accessor_expression.h",
@@ -224,7 +231,7 @@
}
}
-config("tint_spv_reader_config") {
+config("libtint_spv_config") {
include_dirs = [
"${tint_spirv_tools_dir}/",
"${tint_spirv_tools_dir}/include",
@@ -232,7 +239,7 @@
]
}
-source_set("libtint_spv_reader") {
+source_set("libtint_spv_reader_src") {
sources = [
"src/reader/spirv/enum_converter.cc",
"src/reader/spirv/enum_converter.h",
@@ -253,8 +260,10 @@
"${tint_spirv_tools_dir}/:spvtools_val",
]
- configs += [ ":tint_common_config" ]
- configs += [ ":tint_spv_reader_config" ]
+ configs += [
+ ":tint_common_config",
+ ":libtint_spv_config",
+ ]
if (build_with_chromium) {
configs -= [ "//build/config/compiler:chromium_code" ]
@@ -262,7 +271,7 @@
}
}
-source_set("libtint_spv_writer") {
+source_set("libtint_spv_writer_src") {
sources = [
"src/writer/spirv/binary_writer.cc",
"src/writer/spirv/binary_writer.h",
@@ -280,7 +289,10 @@
deps = [ "${tint_spirv_headers_dir}/:spv_headers" ]
- configs += [ ":tint_common_config" ]
+ configs += [
+ ":tint_common_config",
+ ":libtint_spv_config",
+ ]
if (build_with_chromium) {
configs -= [ "//build/config/compiler:chromium_code" ]
@@ -288,7 +300,7 @@
}
}
-source_set("libtint_wgsl_reader") {
+source_set("libtint_wgsl_reader_src") {
sources = [
"src/reader/wgsl/lexer.cc",
"src/reader/wgsl/lexer.h",
@@ -308,7 +320,7 @@
}
}
-source_set("libtint_wgsl_writer") {
+source_set("libtint_wgsl_writer_src") {
sources = [
"src/writer/wgsl/generator.cc",
"src/writer/wgsl/generator.h",
@@ -325,22 +337,22 @@
}
source_set("libtint") {
- deps = [ ":libtint_core" ]
+ deps = [ ":libtint_core_src" ]
if (tint_build_spv_reader) {
- deps += [ ":libtint_spv_reader" ]
+ deps += [ ":libtint_spv_reader_src" ]
}
if (tint_build_spv_writer) {
- deps += [ ":libtint_spv_writer" ]
+ deps += [ ":libtint_spv_writer_src" ]
}
if (tint_build_wgsl_reader) {
- deps += [ ":libtint_wgsl_reader" ]
+ deps += [ ":libtint_wgsl_reader_src" ]
}
if (tint_build_wgsl_writer) {
- deps += [ ":libtint_wgsl_writer" ]
+ deps += [ ":libtint_wgsl_writer_src" ]
}
configs += [ ":tint_common_config" ]
@@ -351,6 +363,408 @@
}
}
+###############################################################################
+# Gtest Gmock - Handle building inside and outside of Chromium.
+###############################################################################
+# When building outside of Chromium we need to define our own targets for GTest
+# and GMock. However when compiling inside of Chromium we need to reuse the
+# existing targets, both because Chromium has a special harness for swarming
+# and because otherwise the "gn check" fails.
+
+if (!build_with_chromium) {
+ # When we aren't in Chromium we define out own targets based on the location
+ # of the googletest repo.
+ config("gtest_config") {
+ include_dirs = [
+ "${tint_googletest_dir}/googletest",
+ "${tint_googletest_dir}/googletest/include",
+ ]
+ }
+ static_library("gtest") {
+ testonly = true
+ sources = [ "${tint_googletest_dir}/googletest/src/gtest-all.cc" ]
+ public_configs = [ ":gtest_config" ]
+ }
+
+ config("gmock_config") {
+ include_dirs = [
+ "${tint_googletest_dir}/googlemock",
+ "${tint_googletest_dir}/googlemock/include",
+ "${tint_googletest_dir}/googletest/include",
+ ]
+ }
+
+ static_library("gmock") {
+ testonly = true
+ sources = [
+ "${tint_googletest_dir}/googlemock/src/gmock-all.cc",
+ "${tint_googletest_dir}/googlemock/src/gmock_main.cc",
+ ]
+ public_configs = [ ":gmock_config" ]
+ }
+
+ group("gmock_and_gtest") {
+ testonly = true
+ public_deps = [
+ ":gmock",
+ ":gtest",
+ ]
+ }
+} else {
+ # When we are in Chromium we reuse its targets, and also add some deps that
+ # are needed to launch the test in swarming mode.
+ group("gmock_and_gtest") {
+ testonly = true
+ public_deps = [
+ "//base",
+ "//base/test:test_support",
+ "//testing/gmock",
+ "//testing/gtest",
+ ]
+ }
+}
+
+###############################################################################
+# Tests - For libtint core and optional modules
+###############################################################################
+config("tint_unittests_config") {
+ include_dirs = [
+ "${tint_googletest_dir}/googlemock/include",
+ "${tint_googletest_dir}/googletest/include",
+ ]
+}
+
+source_set("tint_unittests_core_src") {
+ sources = [
+ "src/ast/array_accessor_expression_test.cc",
+ "src/ast/as_expression_test.cc",
+ "src/ast/assignment_statement_test.cc",
+ "src/ast/binary_expression_test.cc",
+ "src/ast/binding_decoration_test.cc",
+ "src/ast/bool_literal_test.cc",
+ "src/ast/break_statement_test.cc",
+ "src/ast/builtin_decoration_test.cc",
+ "src/ast/call_expression_test.cc",
+ "src/ast/case_statement_test.cc",
+ "src/ast/cast_expression_test.cc",
+ "src/ast/continue_statement_test.cc",
+ "src/ast/decorated_variable_test.cc",
+ "src/ast/else_statement_test.cc",
+ "src/ast/entry_point_test.cc",
+ "src/ast/fallthrough_statement_test.cc",
+ "src/ast/float_literal_test.cc",
+ "src/ast/function_test.cc",
+ "src/ast/identifier_expression_test.cc",
+ "src/ast/if_statement_test.cc",
+ "src/ast/import_test.cc",
+ "src/ast/int_literal_test.cc",
+ "src/ast/kill_statement_test.cc",
+ "src/ast/location_decoration_test.cc",
+ "src/ast/loop_statement_test.cc",
+ "src/ast/member_accessor_expression_test.cc",
+ "src/ast/module_test.cc",
+ "src/ast/nop_statement_test.cc",
+ "src/ast/return_statement_test.cc",
+ "src/ast/scalar_constructor_expression_test.cc",
+ "src/ast/set_decoration_test.cc",
+ "src/ast/struct_member_offset_decoration_test.cc",
+ "src/ast/struct_member_test.cc",
+ "src/ast/struct_test.cc",
+ "src/ast/switch_statement_test.cc",
+ "src/ast/type/alias_type_test.cc",
+ "src/ast/type/array_type_test.cc",
+ "src/ast/type/bool_type_test.cc",
+ "src/ast/type/f32_type_test.cc",
+ "src/ast/type/i32_type_test.cc",
+ "src/ast/type/matrix_type_test.cc",
+ "src/ast/type/pointer_type_test.cc",
+ "src/ast/type/struct_type_test.cc",
+ "src/ast/type/u32_type_test.cc",
+ "src/ast/type/vector_type_test.cc",
+ "src/ast/type_constructor_expression_test.cc",
+ "src/ast/uint_literal_test.cc",
+ "src/ast/unary_derivative_expression_test.cc",
+ "src/ast/unary_method_expression_test.cc",
+ "src/ast/unary_op_expression_test.cc",
+ "src/ast/unless_statement_test.cc",
+ "src/ast/variable_decl_statement_test.cc",
+ "src/ast/variable_test.cc",
+ "src/scope_stack_test.cc",
+ "src/type_determiner_test.cc",
+ "src/type_manager_test.cc",
+ "src/validator_impl_import_test.cc",
+ ]
+
+ configs += [
+ ":tint_common_config",
+ ":tint_unittests_config",
+ ]
+
+ if (build_with_chromium) {
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ }
+}
+
+source_set("tint_unittests_spv_reader_src") {
+ sources = [
+ "src/reader/spirv/enum_converter_test.cc",
+ "src/reader/spirv/fail_stream_test.cc",
+ "src/reader/spirv/function_arithmetic_test.cc",
+ "src/reader/spirv/function_decl_test.cc",
+ "src/reader/spirv/function_logical_test.cc",
+ "src/reader/spirv/function_memory_test.cc",
+ "src/reader/spirv/function_var_test.cc",
+ "src/reader/spirv/namer_test.cc",
+ "src/reader/spirv/parser_impl_convert_member_decoration_test.cc",
+ "src/reader/spirv/parser_impl_convert_type_test.cc",
+ "src/reader/spirv/parser_impl_entry_point_test.cc",
+ "src/reader/spirv/parser_impl_function_decl_test.cc",
+ "src/reader/spirv/parser_impl_get_decorations_test.cc",
+ "src/reader/spirv/parser_impl_import_test.cc",
+ "src/reader/spirv/parser_impl_module_var_test.cc",
+ "src/reader/spirv/parser_impl_named_types_test.cc",
+ "src/reader/spirv/parser_impl_test.cc",
+ "src/reader/spirv/parser_impl_user_name_test.cc",
+ "src/reader/spirv/parser_test.cc",
+ "src/reader/spirv/spirv_tools_helpers_test.cc",
+ "src/reader/spirv/spirv_tools_helpers_test.h",
+ ]
+
+ deps = [ "${tint_spirv_headers_dir}/:spv_headers" ]
+
+ configs += [
+ ":libtint_spv_config",
+ ":tint_common_config",
+ ":tint_unittests_config",
+ ]
+
+ if (build_with_chromium) {
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ }
+}
+
+source_set("tint_unittests_spv_writer_src") {
+ sources = [
+ "src/writer/spirv/binary_writer_test.cc",
+ "src/writer/spirv/builder_assign_test.cc",
+ "src/writer/spirv/builder_binary_expression_test.cc",
+ "src/writer/spirv/builder_constructor_expression_test.cc",
+ "src/writer/spirv/builder_entry_point_test.cc",
+ "src/writer/spirv/builder_function_test.cc",
+ "src/writer/spirv/builder_function_variable_test.cc",
+ "src/writer/spirv/builder_global_variable_test.cc",
+ "src/writer/spirv/builder_ident_expression_test.cc",
+ "src/writer/spirv/builder_if_test.cc",
+ "src/writer/spirv/builder_literal_test.cc",
+ "src/writer/spirv/builder_return_test.cc",
+ "src/writer/spirv/builder_test.cc",
+ "src/writer/spirv/builder_type_test.cc",
+ "src/writer/spirv/instruction_test.cc",
+ "src/writer/spirv/operand_test.cc",
+ "src/writer/spirv/spv_dump.cc",
+ "src/writer/spirv/spv_dump.h",
+ ]
+ deps = [ "${tint_spirv_headers_dir}/:spv_headers" ]
+
+ configs += [
+ ":libtint_spv_config",
+ ":tint_common_config",
+ ":tint_unittests_config",
+ ]
+
+ if (build_with_chromium) {
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ }
+}
+
+source_set("tint_unittests_wgsl_reader_src") {
+ sources = [
+ "src/reader/wgsl/lexer_test.cc",
+ "src/reader/wgsl/parser_impl_additive_expression_test.cc",
+ "src/reader/wgsl/parser_impl_and_expression_test.cc",
+ "src/reader/wgsl/parser_impl_argument_expression_list_test.cc",
+ "src/reader/wgsl/parser_impl_assignment_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_body_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_break_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_builtin_decoration_test.cc",
+ "src/reader/wgsl/parser_impl_case_body_test.cc",
+ "src/reader/wgsl/parser_impl_const_expr_test.cc",
+ "src/reader/wgsl/parser_impl_const_literal_test.cc",
+ "src/reader/wgsl/parser_impl_continue_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_continuing_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_derivative_modifier_test.cc",
+ "src/reader/wgsl/parser_impl_else_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_elseif_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_entry_point_decl_test.cc",
+ "src/reader/wgsl/parser_impl_equality_expression_test.cc",
+ "src/reader/wgsl/parser_impl_exclusive_or_expression_test.cc",
+ "src/reader/wgsl/parser_impl_function_decl_test.cc",
+ "src/reader/wgsl/parser_impl_function_header_test.cc",
+ "src/reader/wgsl/parser_impl_function_type_decl_test.cc",
+ "src/reader/wgsl/parser_impl_global_constant_decl_test.cc",
+ "src/reader/wgsl/parser_impl_global_decl_test.cc",
+ "src/reader/wgsl/parser_impl_global_variable_decl_test.cc",
+ "src/reader/wgsl/parser_impl_if_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_import_decl_test.cc",
+ "src/reader/wgsl/parser_impl_inclusive_or_expression_test.cc",
+ "src/reader/wgsl/parser_impl_logical_and_expression_test.cc",
+ "src/reader/wgsl/parser_impl_logical_or_expression_test.cc",
+ "src/reader/wgsl/parser_impl_loop_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_multiplicative_expression_test.cc",
+ "src/reader/wgsl/parser_impl_param_list_test.cc",
+ "src/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_pipeline_stage_test.cc",
+ "src/reader/wgsl/parser_impl_postfix_expression_test.cc",
+ "src/reader/wgsl/parser_impl_primary_expression_test.cc",
+ "src/reader/wgsl/parser_impl_relational_expression_test.cc",
+ "src/reader/wgsl/parser_impl_shift_expression_test.cc",
+ "src/reader/wgsl/parser_impl_statement_test.cc",
+ "src/reader/wgsl/parser_impl_statements_test.cc",
+ "src/reader/wgsl/parser_impl_storage_class_test.cc",
+ "src/reader/wgsl/parser_impl_struct_body_decl_test.cc",
+ "src/reader/wgsl/parser_impl_struct_decl_test.cc",
+ "src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc",
+ "src/reader/wgsl/parser_impl_struct_decoration_test.cc",
+ "src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc",
+ "src/reader/wgsl/parser_impl_struct_member_decoration_test.cc",
+ "src/reader/wgsl/parser_impl_struct_member_test.cc",
+ "src/reader/wgsl/parser_impl_switch_body_test.cc",
+ "src/reader/wgsl/parser_impl_switch_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_test.cc",
+ "src/reader/wgsl/parser_impl_test_helper.cc",
+ "src/reader/wgsl/parser_impl_test_helper.h",
+ "src/reader/wgsl/parser_impl_type_alias_test.cc",
+ "src/reader/wgsl/parser_impl_type_decl_test.cc",
+ "src/reader/wgsl/parser_impl_unary_expression_test.cc",
+ "src/reader/wgsl/parser_impl_unless_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_variable_decl_test.cc",
+ "src/reader/wgsl/parser_impl_variable_decoration_list_test.cc",
+ "src/reader/wgsl/parser_impl_variable_decoration_test.cc",
+ "src/reader/wgsl/parser_impl_variable_ident_decl_test.cc",
+ "src/reader/wgsl/parser_impl_variable_stmt_test.cc",
+ "src/reader/wgsl/parser_impl_variable_storage_decoration_test.cc",
+ "src/reader/wgsl/parser_test.cc",
+ "src/reader/wgsl/token_test.cc",
+ ]
+
+ configs += [
+ ":tint_common_config",
+ ":tint_unittests_config",
+ ]
+
+ if (build_with_chromium) {
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ }
+}
+
+source_set("tint_unittests_wgsl_writer_src") {
+ sources = [
+ "src/writer/wgsl/generator_impl_alias_type_test.cc",
+ "src/writer/wgsl/generator_impl_array_accessor_test.cc",
+ "src/writer/wgsl/generator_impl_as_test.cc",
+ "src/writer/wgsl/generator_impl_assign_test.cc",
+ "src/writer/wgsl/generator_impl_break_test.cc",
+ "src/writer/wgsl/generator_impl_call_test.cc",
+ "src/writer/wgsl/generator_impl_case_test.cc",
+ "src/writer/wgsl/generator_impl_cast_test.cc",
+ "src/writer/wgsl/generator_impl_constructor_test.cc",
+ "src/writer/wgsl/generator_impl_continue_test.cc",
+ "src/writer/wgsl/generator_impl_else_test.cc",
+ "src/writer/wgsl/generator_impl_entry_point_test.cc",
+ "src/writer/wgsl/generator_impl_fallthrough_test.cc",
+ "src/writer/wgsl/generator_impl_function_test.cc",
+ "src/writer/wgsl/generator_impl_identifier_test.cc",
+ "src/writer/wgsl/generator_impl_if_test.cc",
+ "src/writer/wgsl/generator_impl_import_test.cc",
+ "src/writer/wgsl/generator_impl_kill_test.cc",
+ "src/writer/wgsl/generator_impl_loop_test.cc",
+ "src/writer/wgsl/generator_impl_member_accessor_test.cc",
+ "src/writer/wgsl/generator_impl_nop_test.cc",
+ "src/writer/wgsl/generator_impl_relational_test.cc",
+ "src/writer/wgsl/generator_impl_return_test.cc",
+ "src/writer/wgsl/generator_impl_switch_test.cc",
+ "src/writer/wgsl/generator_impl_test.cc",
+ "src/writer/wgsl/generator_impl_type_test.cc",
+ "src/writer/wgsl/generator_impl_unary_derivative_test.cc",
+ "src/writer/wgsl/generator_impl_unary_method_test.cc",
+ "src/writer/wgsl/generator_impl_unary_op_test.cc",
+ "src/writer/wgsl/generator_impl_unless_test.cc",
+ "src/writer/wgsl/generator_impl_variable_decl_statement_test.cc",
+ "src/writer/wgsl/generator_impl_variable_test.cc",
+ ]
+
+ configs += [
+ ":tint_common_config",
+ ":tint_unittests_config",
+ ]
+
+ if (build_with_chromium) {
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ }
+}
+
+source_set("tint_unittests_src") {
+ deps = [ ":tint_unittests_core_src" ]
+
+ if (tint_build_spv_reader) {
+ deps += [ ":tint_unittests_spv_reader_src" ]
+ }
+
+ if (tint_build_spv_writer) {
+ deps += [ ":tint_unittests_spv_writer_src" ]
+ }
+
+ if (tint_build_wgsl_reader) {
+ deps += [ ":tint_unittests_wgsl_reader_src" ]
+ }
+
+ if (tint_build_wgsl_writer) {
+ deps += [ ":tint_unittests_wgsl_writer_src" ]
+ }
+
+ configs += [
+ ":tint_common_config",
+ ":tint_unittests_config",
+ ]
+
+ if (build_with_chromium) {
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ }
+}
+
+test("tint_unittests") {
+ deps = [
+ ":gmock_and_gtest",
+ ":libtint",
+ ":tint_unittests_src",
+ ]
+
+ # TODO(rharrison): Use main() from chromium for chromium tree builds. This
+ # requires adding a file to //gpu like Dawn has done.
+
+ configs += [
+ ":tint_common_config",
+ ":tint_unittests_config",
+ ]
+
+ if (build_with_chromium) {
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ }
+
+ testonly = true
+}
+
+###############################################################################
+# Samples - Executables exposing command line functionality
+###############################################################################
+
config("tint_exe_config") {
include_dirs = []
if (tint_build_spv_reader || tint_build_spv_writer) {
@@ -363,7 +777,7 @@
deps = [ ":libtint" ]
if (tint_build_spv_reader || tint_build_spv_writer) {
- deps += ["${tint_spirv_headers_dir}/:spv_headers" ]
+ deps += [ "${tint_spirv_headers_dir}/:spv_headers" ]
}
configs += [ ":tint_common_config" ]
@@ -374,7 +788,3 @@
configs += [ "//build/config/compiler:no_chromium_code" ]
}
}
-
-group("tint_all") {
- deps = [ ":tint_exe" ]
-}
diff --git a/DEPS b/DEPS
index 8cad279..a4e62d5 100644
--- a/DEPS
+++ b/DEPS
@@ -9,18 +9,16 @@
'buildtools_revision': '74cfb57006f83cfe050817526db359d5c8a11628',
'clang_revision': '3605577b67603ec5776afcfada9e0ff4ea05cf0e',
'cpplint_revision': '305ac8725a166ed42e3f5dd3f80d6de2cf840ef1',
- 'googletest_revision': '482ac6ee63429af2aa9c44f4e6427873fb68fb1f',
+ 'googletest_revision': 'dcc92d0ab6c4ce022162a23566d44f673251eee4',
'spirv_headers_revision': 'f8bf11a0253a32375c32cad92c841237b96696c0',
'spirv_tools_revision': '60104cd97446877dad8ed1010a635218937a2f18',
+ 'testing_revision': 'e5ced5141379ee8ae28b4f93d3c02df039d2b052',
}
deps = {
'third_party/cpplint': Var('chromium_git') + Var('github') +
'/google/styleguide.git@' + Var('cpplint_revision'),
- 'third_party/googletest': Var('chromium_git') + Var('github') +
- '/google/googletest.git@' + Var('googletest_revision'),
-
'third_party/spirv-headers': Var('chromium_git') + Var('github') +
'/KhronosGroup/SPIRV-Headers.git@' + Var('spirv_headers_revision'),
@@ -39,6 +37,13 @@
'third_party/binutils': Var('chromium_git') +
'/chromium/src/third_party/binutils@' + Var('binutils_revision'),
+
+ # Dependencies required for testing
+ 'testing': Var('chromium_git') + '/chromium/src/testing@' +
+ Var('testing_revision'),
+
+ 'third_party/googletest': Var('chromium_git') + Var('github') +
+ '/google/googletest.git@' + Var('googletest_revision'),
}
hooks = [
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9a1077b..9d2c2fe 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -402,6 +402,7 @@
reader/wgsl/parser_impl_switch_body_test.cc
reader/wgsl/parser_impl_switch_stmt_test.cc
reader/wgsl/parser_impl_test.cc
+ reader/wgsl/parser_impl_test_helper.cc
reader/wgsl/parser_impl_test_helper.h
reader/wgsl/parser_impl_type_alias_test.cc
reader/wgsl/parser_impl_type_decl_test.cc
diff --git a/src/ast/array_accessor_expression_test.cc b/src/ast/array_accessor_expression_test.cc
index 833e46f..a08a837 100644
--- a/src/ast/array_accessor_expression_test.cc
+++ b/src/ast/array_accessor_expression_test.cc
@@ -27,8 +27,8 @@
auto ary = std::make_unique<IdentifierExpression>("ary");
auto idx = std::make_unique<IdentifierExpression>("idx");
- auto ary_ptr = ary.get();
- auto idx_ptr = idx.get();
+ auto* ary_ptr = ary.get();
+ auto* idx_ptr = idx.get();
ArrayAccessorExpression exp(std::move(ary), std::move(idx));
ASSERT_EQ(exp.array(), ary_ptr);
@@ -40,8 +40,8 @@
ArrayAccessorExpression exp(Source{20, 2}, std::move(ary), std::move(idx));
auto src = exp.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(ArrayAccessorExpressionTest, IsArrayAccessor) {
diff --git a/src/ast/as_expression_test.cc b/src/ast/as_expression_test.cc
index e41c0ba..e29a89d 100644
--- a/src/ast/as_expression_test.cc
+++ b/src/ast/as_expression_test.cc
@@ -28,7 +28,7 @@
type::F32Type f32;
auto expr = std::make_unique<IdentifierExpression>("expr");
- auto expr_ptr = expr.get();
+ auto* expr_ptr = expr.get();
AsExpression exp(&f32, std::move(expr));
ASSERT_EQ(exp.type(), &f32);
@@ -41,8 +41,8 @@
AsExpression exp(Source{20, 2}, &f32, std::move(expr));
auto src = exp.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(AsExpressionTest, IsAs) {
diff --git a/src/ast/assignment_statement_test.cc b/src/ast/assignment_statement_test.cc
index f8959e3..85a29d6 100644
--- a/src/ast/assignment_statement_test.cc
+++ b/src/ast/assignment_statement_test.cc
@@ -27,8 +27,8 @@
auto lhs = std::make_unique<ast::IdentifierExpression>("lhs");
auto rhs = std::make_unique<ast::IdentifierExpression>("rhs");
- auto lhs_ptr = lhs.get();
- auto rhs_ptr = rhs.get();
+ auto* lhs_ptr = lhs.get();
+ auto* rhs_ptr = rhs.get();
AssignmentStatement stmt(std::move(lhs), std::move(rhs));
EXPECT_EQ(stmt.lhs(), lhs_ptr);
@@ -41,8 +41,8 @@
AssignmentStatement stmt(Source{20, 2}, std::move(lhs), std::move(rhs));
auto src = stmt.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(AssignmentStatementTest, IsAssign) {
diff --git a/src/ast/binary_expression_test.cc b/src/ast/binary_expression_test.cc
index 0ca73aa..b7c50b1 100644
--- a/src/ast/binary_expression_test.cc
+++ b/src/ast/binary_expression_test.cc
@@ -29,8 +29,8 @@
auto lhs = std::make_unique<IdentifierExpression>("lhs");
auto rhs = std::make_unique<IdentifierExpression>("rhs");
- auto lhs_ptr = lhs.get();
- auto rhs_ptr = rhs.get();
+ auto* lhs_ptr = lhs.get();
+ auto* rhs_ptr = rhs.get();
BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs));
EXPECT_EQ(r.lhs(), lhs_ptr);
@@ -45,8 +45,8 @@
BinaryExpression r(Source{20, 2}, BinaryOp::kEqual, std::move(lhs),
std::move(rhs));
auto src = r.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(BinaryExpressionTest, IsBinaryal) {
diff --git a/src/ast/binding_decoration_test.cc b/src/ast/binding_decoration_test.cc
index 71fefdf..677fd69 100644
--- a/src/ast/binding_decoration_test.cc
+++ b/src/ast/binding_decoration_test.cc
@@ -24,7 +24,7 @@
TEST_F(BindingDecorationTest, Creation) {
BindingDecoration d{2};
- EXPECT_EQ(2, d.value());
+ EXPECT_EQ(2u, d.value());
}
TEST_F(BindingDecorationTest, Is) {
diff --git a/src/ast/break_statement_test.cc b/src/ast/break_statement_test.cc
index 87ace59..49df1ba 100644
--- a/src/ast/break_statement_test.cc
+++ b/src/ast/break_statement_test.cc
@@ -32,7 +32,7 @@
TEST_F(BreakStatementTest, CreationWithConditional) {
auto expr = std::make_unique<IdentifierExpression>("expr");
- auto expr_ptr = expr.get();
+ auto* expr_ptr = expr.get();
BreakStatement stmt(StatementCondition::kIf, std::move(expr));
EXPECT_EQ(stmt.condition(), StatementCondition::kIf);
@@ -42,8 +42,8 @@
TEST_F(BreakStatementTest, Creation_WithSource) {
BreakStatement stmt(Source{20, 2});
auto src = stmt.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(BreakStatementTest, Creation_WithSourceAndCondition) {
@@ -52,8 +52,8 @@
BreakStatement stmt(Source{20, 2}, StatementCondition::kUnless,
std::move(expr));
auto src = stmt.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(BreakStatementTest, IsBreak) {
diff --git a/src/ast/call_expression_test.cc b/src/ast/call_expression_test.cc
index e88627f..a89441f 100644
--- a/src/ast/call_expression_test.cc
+++ b/src/ast/call_expression_test.cc
@@ -29,15 +29,15 @@
params.push_back(std::make_unique<IdentifierExpression>("param1"));
params.push_back(std::make_unique<IdentifierExpression>("param2"));
- auto func_ptr = func.get();
- auto param1_ptr = params[0].get();
- auto param2_ptr = params[1].get();
+ auto* func_ptr = func.get();
+ auto* param1_ptr = params[0].get();
+ auto* param2_ptr = params[1].get();
CallExpression stmt(std::move(func), std::move(params));
EXPECT_EQ(stmt.func(), func_ptr);
const auto& vec = stmt.params();
- ASSERT_EQ(vec.size(), 2);
+ ASSERT_EQ(vec.size(), 2u);
EXPECT_EQ(vec[0].get(), param1_ptr);
EXPECT_EQ(vec[1].get(), param2_ptr);
}
@@ -46,8 +46,8 @@
auto func = std::make_unique<IdentifierExpression>("func");
CallExpression stmt(Source{20, 2}, std::move(func), {});
auto src = stmt.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(CallExpressionTest, IsCall) {
diff --git a/src/ast/case_statement_test.cc b/src/ast/case_statement_test.cc
index b88b0fe..8aad2ba 100644
--- a/src/ast/case_statement_test.cc
+++ b/src/ast/case_statement_test.cc
@@ -32,12 +32,12 @@
StatementList stmts;
stmts.push_back(std::make_unique<NopStatement>());
- auto bool_ptr = b.get();
- auto nop_ptr = stmts[0].get();
+ auto* bool_ptr = b.get();
+ auto* nop_ptr = stmts[0].get();
CaseStatement c(std::move(b), std::move(stmts));
EXPECT_EQ(c.condition(), bool_ptr);
- ASSERT_EQ(c.body().size(), 1);
+ ASSERT_EQ(c.body().size(), 1u);
EXPECT_EQ(c.body()[0].get(), nop_ptr);
}
@@ -49,8 +49,8 @@
CaseStatement c(Source{20, 2}, std::move(b), std::move(stmts));
auto src = c.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(CaseStatementTest, IsDefault_WithoutCondition) {
diff --git a/src/ast/cast_expression_test.cc b/src/ast/cast_expression_test.cc
index d7f9498..4fe7566 100644
--- a/src/ast/cast_expression_test.cc
+++ b/src/ast/cast_expression_test.cc
@@ -27,7 +27,7 @@
TEST_F(CastExpressionTest, Creation) {
type::F32Type f32;
auto expr = std::make_unique<IdentifierExpression>("expr");
- auto expr_ptr = expr.get();
+ auto* expr_ptr = expr.get();
CastExpression c(&f32, std::move(expr));
EXPECT_EQ(c.type(), &f32);
@@ -40,8 +40,8 @@
CastExpression c(Source{20, 2}, &f32, std::move(expr));
auto src = c.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(CastExpressionTest, IsCast) {
diff --git a/src/ast/continue_statement_test.cc b/src/ast/continue_statement_test.cc
index 5f4a88c..10026bd 100644
--- a/src/ast/continue_statement_test.cc
+++ b/src/ast/continue_statement_test.cc
@@ -32,7 +32,7 @@
TEST_F(ContinueStatementTest, CreationWithConditional) {
auto expr = std::make_unique<IdentifierExpression>("expr");
- auto expr_ptr = expr.get();
+ auto* expr_ptr = expr.get();
ContinueStatement stmt(StatementCondition::kIf, std::move(expr));
EXPECT_EQ(stmt.condition(), StatementCondition::kIf);
@@ -42,8 +42,8 @@
TEST_F(ContinueStatementTest, Creation_WithSource) {
ContinueStatement stmt(Source{20, 2});
auto src = stmt.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(ContinueStatementTest, Creation_WithSourceAndCondition) {
@@ -52,8 +52,8 @@
ContinueStatement stmt(Source{20, 2}, StatementCondition::kUnless,
std::move(expr));
auto src = stmt.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(ContinueStatementTest, IsContinue) {
diff --git a/src/ast/decorated_variable_test.cc b/src/ast/decorated_variable_test.cc
index 11954ab..01d39f0 100644
--- a/src/ast/decorated_variable_test.cc
+++ b/src/ast/decorated_variable_test.cc
@@ -37,8 +37,8 @@
EXPECT_EQ(dv.name(), "my_var");
EXPECT_EQ(dv.storage_class(), StorageClass::kFunction);
EXPECT_EQ(dv.type(), &t);
- EXPECT_EQ(dv.line(), 0);
- EXPECT_EQ(dv.column(), 0);
+ EXPECT_EQ(dv.line(), 0u);
+ EXPECT_EQ(dv.column(), 0u);
}
TEST_F(DecoratedVariableTest, CreationWithSource) {
@@ -50,8 +50,8 @@
EXPECT_EQ(dv.name(), "i");
EXPECT_EQ(dv.storage_class(), StorageClass::kPrivate);
EXPECT_EQ(dv.type(), &t);
- EXPECT_EQ(dv.line(), 27);
- EXPECT_EQ(dv.column(), 4);
+ EXPECT_EQ(dv.line(), 27u);
+ EXPECT_EQ(dv.column(), 4u);
}
TEST_F(DecoratedVariableTest, IsValid) {
diff --git a/src/ast/else_statement_test.cc b/src/ast/else_statement_test.cc
index bfa0c77..07ee8ec 100644
--- a/src/ast/else_statement_test.cc
+++ b/src/ast/else_statement_test.cc
@@ -34,20 +34,20 @@
StatementList body;
body.push_back(std::make_unique<NopStatement>());
- auto cond_ptr = cond.get();
- auto nop_ptr = body[0].get();
+ auto* cond_ptr = cond.get();
+ auto* nop_ptr = body[0].get();
ElseStatement e(std::move(cond), std::move(body));
EXPECT_EQ(e.condition(), cond_ptr);
- ASSERT_EQ(e.body().size(), 1);
+ ASSERT_EQ(e.body().size(), 1u);
EXPECT_EQ(e.body()[0].get(), nop_ptr);
}
TEST_F(ElseStatementTest, Creation_WithSource) {
ElseStatement e(Source{20, 2}, {});
auto src = e.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(ElseStatementTest, IsElse) {
diff --git a/src/ast/entry_point_test.cc b/src/ast/entry_point_test.cc
index 2dfb0b8..0f34fb9 100644
--- a/src/ast/entry_point_test.cc
+++ b/src/ast/entry_point_test.cc
@@ -30,8 +30,8 @@
EXPECT_EQ(e.name(), "main");
EXPECT_EQ(e.function_name(), "vtx_main");
EXPECT_EQ(e.stage(), PipelineStage::kVertex);
- EXPECT_EQ(e.line(), 0);
- EXPECT_EQ(e.column(), 0);
+ EXPECT_EQ(e.line(), 0u);
+ EXPECT_EQ(e.column(), 0u);
}
TEST_F(EntryPointTest, CreationWithSource) {
@@ -41,8 +41,8 @@
EXPECT_EQ(e.name(), "main");
EXPECT_EQ(e.function_name(), "vtx_main");
EXPECT_EQ(e.stage(), PipelineStage::kVertex);
- EXPECT_EQ(e.line(), 27);
- EXPECT_EQ(e.column(), 4);
+ EXPECT_EQ(e.line(), 27u);
+ EXPECT_EQ(e.column(), 4u);
}
TEST_F(EntryPointTest, CreationEmpty) {
@@ -56,8 +56,8 @@
EXPECT_EQ(e.function_name(), "my_func");
EXPECT_EQ(e.name(), "a_name");
EXPECT_EQ(e.stage(), PipelineStage::kFragment);
- EXPECT_EQ(e.line(), 27);
- EXPECT_EQ(e.column(), 4);
+ EXPECT_EQ(e.line(), 27u);
+ EXPECT_EQ(e.column(), 4u);
}
TEST_F(EntryPointTest, IsValid) {
diff --git a/src/ast/fallthrough_statement_test.cc b/src/ast/fallthrough_statement_test.cc
index 632b940..c7dbe58 100644
--- a/src/ast/fallthrough_statement_test.cc
+++ b/src/ast/fallthrough_statement_test.cc
@@ -24,15 +24,15 @@
TEST_F(FallthroughStatementTest, Creation) {
FallthroughStatement stmt;
- EXPECT_EQ(stmt.line(), 0);
- EXPECT_EQ(stmt.column(), 0);
+ EXPECT_EQ(stmt.line(), 0u);
+ EXPECT_EQ(stmt.column(), 0u);
}
TEST_F(FallthroughStatementTest, Creation_WithSource) {
FallthroughStatement stmt(Source{20, 2});
auto src = stmt.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(FallthroughStatementTest, IsFallthrough) {
diff --git a/src/ast/function_test.cc b/src/ast/function_test.cc
index adac67d..faae8d1 100644
--- a/src/ast/function_test.cc
+++ b/src/ast/function_test.cc
@@ -34,11 +34,11 @@
VariableList params;
params.push_back(
std::make_unique<Variable>("var", StorageClass::kNone, &i32));
- auto var_ptr = params[0].get();
+ auto* var_ptr = params[0].get();
Function f("func", std::move(params), &void_type);
EXPECT_EQ(f.name(), "func");
- ASSERT_EQ(f.params().size(), 1);
+ ASSERT_EQ(f.params().size(), 1u);
EXPECT_EQ(f.return_type(), &void_type);
EXPECT_EQ(f.params()[0].get(), var_ptr);
}
@@ -53,8 +53,8 @@
Function f(Source{20, 2}, "func", std::move(params), &void_type);
auto src = f.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(FunctionTest, IsValid) {
diff --git a/src/ast/identifier_expression_test.cc b/src/ast/identifier_expression_test.cc
index 3252ab3..44eeb9f 100644
--- a/src/ast/identifier_expression_test.cc
+++ b/src/ast/identifier_expression_test.cc
@@ -24,20 +24,20 @@
TEST_F(IdentifierExpressionTest, Creation) {
IdentifierExpression i("ident");
- ASSERT_EQ(i.name().size(), 1);
+ ASSERT_EQ(i.name().size(), 1u);
EXPECT_EQ(i.name()[0], "ident");
}
TEST_F(IdentifierExpressionTest, Creation_WithSource) {
IdentifierExpression i(Source{20, 2}, {"ns1", "ns2", "ident"});
- ASSERT_EQ(i.name().size(), 3);
+ ASSERT_EQ(i.name().size(), 3u);
EXPECT_EQ(i.name()[0], "ns1");
EXPECT_EQ(i.name()[1], "ns2");
EXPECT_EQ(i.name()[2], "ident");
auto src = i.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(IdentifierExpressionTest, IsIdentifier) {
diff --git a/src/ast/if_statement_test.cc b/src/ast/if_statement_test.cc
index 7a96899..8455613 100644
--- a/src/ast/if_statement_test.cc
+++ b/src/ast/if_statement_test.cc
@@ -30,12 +30,12 @@
StatementList body;
body.push_back(std::make_unique<NopStatement>());
- auto cond_ptr = cond.get();
- auto stmt_ptr = body[0].get();
+ auto* cond_ptr = cond.get();
+ auto* stmt_ptr = body[0].get();
IfStatement stmt(std::move(cond), std::move(body));
EXPECT_EQ(stmt.condition(), cond_ptr);
- ASSERT_EQ(stmt.body().size(), 1);
+ ASSERT_EQ(stmt.body().size(), 1u);
EXPECT_EQ(stmt.body()[0].get(), stmt_ptr);
}
@@ -46,8 +46,8 @@
IfStatement stmt(Source{20, 2}, std::move(cond), std::move(body));
auto src = stmt.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(IfStatementTest, IsIf) {
diff --git a/src/ast/import_test.cc b/src/ast/import_test.cc
index 0bde102..af77bab 100644
--- a/src/ast/import_test.cc
+++ b/src/ast/import_test.cc
@@ -29,8 +29,8 @@
EXPECT_EQ(i.path(), "GLSL.std.430");
EXPECT_EQ(i.name(), "std::glsl");
- EXPECT_EQ(i.line(), 0);
- EXPECT_EQ(i.column(), 0);
+ EXPECT_EQ(i.line(), 0u);
+ EXPECT_EQ(i.column(), 0u);
}
TEST_F(ImportTest, CreationWithSource) {
@@ -39,8 +39,8 @@
EXPECT_EQ(i.path(), "GLSL.std.430");
EXPECT_EQ(i.name(), "std::glsl");
- EXPECT_EQ(i.line(), 27);
- EXPECT_EQ(i.column(), 4);
+ EXPECT_EQ(i.line(), 27u);
+ EXPECT_EQ(i.column(), 4u);
}
TEST_F(ImportTest, CreationEmpty) {
@@ -52,8 +52,8 @@
EXPECT_EQ(i.path(), "GLSL.std.430");
EXPECT_EQ(i.name(), "std::glsl");
- EXPECT_EQ(i.line(), 27);
- EXPECT_EQ(i.column(), 4);
+ EXPECT_EQ(i.line(), 27u);
+ EXPECT_EQ(i.column(), 4u);
}
TEST_F(ImportTest, to_str) {
diff --git a/src/ast/kill_statement_test.cc b/src/ast/kill_statement_test.cc
index e75988a..653b6ad 100644
--- a/src/ast/kill_statement_test.cc
+++ b/src/ast/kill_statement_test.cc
@@ -26,14 +26,14 @@
TEST_F(KillStatementTest, Creation) {
KillStatement k;
- EXPECT_EQ(k.line(), 0);
- EXPECT_EQ(k.column(), 0);
+ EXPECT_EQ(k.line(), 0u);
+ EXPECT_EQ(k.column(), 0u);
}
TEST_F(KillStatementTest, Creation_WithSource) {
KillStatement k(Source{20, 2});
- EXPECT_EQ(k.line(), 20);
- EXPECT_EQ(k.column(), 2);
+ EXPECT_EQ(k.line(), 20u);
+ EXPECT_EQ(k.column(), 2u);
}
TEST_F(KillStatementTest, IsKill) {
diff --git a/src/ast/location_decoration_test.cc b/src/ast/location_decoration_test.cc
index a5340e8..c0ed6b1 100644
--- a/src/ast/location_decoration_test.cc
+++ b/src/ast/location_decoration_test.cc
@@ -26,7 +26,7 @@
TEST_F(LocationDecorationTest, Creation) {
LocationDecoration d{2};
- EXPECT_EQ(2, d.value());
+ EXPECT_EQ(2u, d.value());
}
TEST_F(LocationDecorationTest, Is) {
diff --git a/src/ast/loop_statement_test.cc b/src/ast/loop_statement_test.cc
index dad5c6b..a12b2f7 100644
--- a/src/ast/loop_statement_test.cc
+++ b/src/ast/loop_statement_test.cc
@@ -31,16 +31,16 @@
TEST_F(LoopStatementTest, Creation) {
StatementList body;
body.push_back(std::make_unique<KillStatement>());
- auto b_ptr = body[0].get();
+ auto* b_ptr = body[0].get();
StatementList continuing;
continuing.push_back(std::make_unique<NopStatement>());
- auto c_ptr = continuing[0].get();
+ auto* c_ptr = continuing[0].get();
LoopStatement l(std::move(body), std::move(continuing));
- ASSERT_EQ(l.body().size(), 1);
+ ASSERT_EQ(l.body().size(), 1u);
EXPECT_EQ(l.body()[0].get(), b_ptr);
- ASSERT_EQ(l.continuing().size(), 1);
+ ASSERT_EQ(l.continuing().size(), 1u);
EXPECT_EQ(l.continuing()[0].get(), c_ptr);
}
@@ -53,8 +53,8 @@
LoopStatement l(Source{20, 2}, std::move(body), std::move(continuing));
auto src = l.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(LoopStatementTest, IsLoop) {
diff --git a/src/ast/member_accessor_expression_test.cc b/src/ast/member_accessor_expression_test.cc
index f42110b..888884e 100644
--- a/src/ast/member_accessor_expression_test.cc
+++ b/src/ast/member_accessor_expression_test.cc
@@ -29,8 +29,8 @@
auto str = std::make_unique<IdentifierExpression>("structure");
auto mem = std::make_unique<IdentifierExpression>("member");
- auto str_ptr = str.get();
- auto mem_ptr = mem.get();
+ auto* str_ptr = str.get();
+ auto* mem_ptr = mem.get();
MemberAccessorExpression stmt(std::move(str), std::move(mem));
EXPECT_EQ(stmt.structure(), str_ptr);
@@ -43,8 +43,8 @@
MemberAccessorExpression stmt(Source{20, 2}, std::move(str), std::move(mem));
auto src = stmt.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(MemberAccessorExpressionTest, IsMemberAccessor) {
diff --git a/src/ast/module_test.cc b/src/ast/module_test.cc
index f9f5968..0e02c13 100644
--- a/src/ast/module_test.cc
+++ b/src/ast/module_test.cc
@@ -33,13 +33,13 @@
TEST_F(ModuleTest, Creation) {
Module m;
- EXPECT_EQ(m.imports().size(), 0);
+ EXPECT_EQ(m.imports().size(), 0u);
}
TEST_F(ModuleTest, ToStrEmitsPreambleAndPostamble) {
Module m;
const auto str = m.to_str();
- const auto expected = "Module{\n}\n";
+ auto* const expected = "Module{\n}\n";
EXPECT_EQ(str, expected);
}
@@ -49,7 +49,7 @@
m.AddImport(std::make_unique<Import>("GLSL.std.430", "std::glsl"));
m.AddImport(std::make_unique<Import>("OpenCL.debug.100", "std::debug"));
- EXPECT_EQ(2, m.imports().size());
+ EXPECT_EQ(2u, m.imports().size());
EXPECT_EQ("std::glsl", m.imports()[0]->name());
}
@@ -70,7 +70,7 @@
m.AddImport(std::move(i));
m.AddImport(std::make_unique<Import>("OpenCL.debug.100", "std::debug"));
- auto import = m.FindImportByName("std::glsl");
+ auto* import = m.FindImportByName("std::glsl");
ASSERT_NE(nullptr, import);
EXPECT_EQ(import->path(), "GLSL.std.430");
EXPECT_EQ(import->name(), "std::glsl");
diff --git a/src/ast/nop_statement_test.cc b/src/ast/nop_statement_test.cc
index 502622d..b7dda99 100644
--- a/src/ast/nop_statement_test.cc
+++ b/src/ast/nop_statement_test.cc
@@ -26,14 +26,14 @@
TEST_F(NopStatementTest, Creation) {
NopStatement n;
- EXPECT_EQ(n.line(), 0);
- EXPECT_EQ(n.column(), 0);
+ EXPECT_EQ(n.line(), 0u);
+ EXPECT_EQ(n.column(), 0u);
}
TEST_F(NopStatementTest, Creation_WithSource) {
NopStatement n(Source{20, 2});
- EXPECT_EQ(n.line(), 20);
- EXPECT_EQ(n.column(), 2);
+ EXPECT_EQ(n.line(), 20u);
+ EXPECT_EQ(n.column(), 2u);
}
TEST_F(NopStatementTest, IsNop) {
diff --git a/src/ast/return_statement_test.cc b/src/ast/return_statement_test.cc
index 3cd4a04..2477015 100644
--- a/src/ast/return_statement_test.cc
+++ b/src/ast/return_statement_test.cc
@@ -27,7 +27,7 @@
TEST_F(ReturnStatementTest, Creation) {
auto expr = std::make_unique<IdentifierExpression>("expr");
- auto expr_ptr = expr.get();
+ auto* expr_ptr = expr.get();
ReturnStatement r(std::move(expr));
EXPECT_EQ(r.value(), expr_ptr);
@@ -36,8 +36,8 @@
TEST_F(ReturnStatementTest, Creation_WithSource) {
ReturnStatement r(Source{20, 2});
auto src = r.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(ReturnStatementTest, IsReturn) {
diff --git a/src/ast/scalar_constructor_expression_test.cc b/src/ast/scalar_constructor_expression_test.cc
index 817905d..ea3dddc 100644
--- a/src/ast/scalar_constructor_expression_test.cc
+++ b/src/ast/scalar_constructor_expression_test.cc
@@ -27,7 +27,7 @@
TEST_F(ScalarConstructorExpressionTest, Creation) {
ast::type::BoolType bool_type;
auto b = std::make_unique<BoolLiteral>(&bool_type, true);
- auto b_ptr = b.get();
+ auto* b_ptr = b.get();
ScalarConstructorExpression c(std::move(b));
EXPECT_EQ(c.literal(), b_ptr);
}
@@ -37,8 +37,8 @@
auto b = std::make_unique<BoolLiteral>(&bool_type, true);
ScalarConstructorExpression c(Source{20, 2}, std::move(b));
auto src = c.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(ScalarConstructorExpressionTest, IsValid) {
diff --git a/src/ast/set_decoration_test.cc b/src/ast/set_decoration_test.cc
index 9b70c4e..5a90c9d 100644
--- a/src/ast/set_decoration_test.cc
+++ b/src/ast/set_decoration_test.cc
@@ -24,7 +24,7 @@
TEST_F(SetDecorationTest, Creation) {
SetDecoration d{2};
- EXPECT_EQ(2, d.value());
+ EXPECT_EQ(2u, d.value());
}
TEST_F(SetDecorationTest, Is) {
diff --git a/src/ast/struct_member_offset_decoration_test.cc b/src/ast/struct_member_offset_decoration_test.cc
index a73b367..141fbe5 100644
--- a/src/ast/struct_member_offset_decoration_test.cc
+++ b/src/ast/struct_member_offset_decoration_test.cc
@@ -24,7 +24,7 @@
TEST_F(StructMemberOffsetDecorationTest, Creation) {
StructMemberOffsetDecoration d{2};
- EXPECT_EQ(2, d.offset());
+ EXPECT_EQ(2u, d.offset());
}
TEST_F(StructMemberOffsetDecorationTest, Is) {
diff --git a/src/ast/struct_member_test.cc b/src/ast/struct_member_test.cc
index b6f3ded..c73a8a8 100644
--- a/src/ast/struct_member_test.cc
+++ b/src/ast/struct_member_test.cc
@@ -35,10 +35,10 @@
StructMember st{"a", &i32, std::move(decorations)};
EXPECT_EQ(st.name(), "a");
EXPECT_EQ(st.type(), &i32);
- EXPECT_EQ(st.decorations().size(), 1);
+ EXPECT_EQ(st.decorations().size(), 1u);
EXPECT_TRUE(st.decorations()[0]->IsOffset());
- EXPECT_EQ(st.line(), 0);
- EXPECT_EQ(st.column(), 0);
+ EXPECT_EQ(st.line(), 0u);
+ EXPECT_EQ(st.column(), 0u);
}
TEST_F(StructMemberTest, CreationWithSource) {
@@ -48,9 +48,9 @@
StructMember st{s, "a", &i32, {}};
EXPECT_EQ(st.name(), "a");
EXPECT_EQ(st.type(), &i32);
- EXPECT_EQ(st.decorations().size(), 0);
- EXPECT_EQ(st.line(), 27);
- EXPECT_EQ(st.column(), 4);
+ EXPECT_EQ(st.decorations().size(), 0u);
+ EXPECT_EQ(st.line(), 27u);
+ EXPECT_EQ(st.column(), 4u);
}
TEST_F(StructMemberTest, IsValid) {
diff --git a/src/ast/struct_test.cc b/src/ast/struct_test.cc
index 15dbad9..0b416a2 100644
--- a/src/ast/struct_test.cc
+++ b/src/ast/struct_test.cc
@@ -36,10 +36,10 @@
std::make_unique<StructMember>("a", &i32, StructMemberDecorationList()));
Struct s{StructDecoration::kNone, std::move(members)};
- EXPECT_EQ(s.members().size(), 1);
+ EXPECT_EQ(s.members().size(), 1u);
EXPECT_EQ(s.decoration(), StructDecoration::kNone);
- EXPECT_EQ(s.line(), 0);
- EXPECT_EQ(s.column(), 0);
+ EXPECT_EQ(s.line(), 0u);
+ EXPECT_EQ(s.column(), 0u);
}
TEST_F(StructTest, CreationWithSource) {
@@ -50,10 +50,10 @@
std::make_unique<StructMember>("a", &i32, StructMemberDecorationList()));
Struct s{source, StructDecoration::kNone, std::move(members)};
- EXPECT_EQ(s.members().size(), 1);
+ EXPECT_EQ(s.members().size(), 1u);
EXPECT_EQ(s.decoration(), StructDecoration::kNone);
- EXPECT_EQ(s.line(), 27);
- EXPECT_EQ(s.column(), 4);
+ EXPECT_EQ(s.line(), 27u);
+ EXPECT_EQ(s.column(), 4u);
}
TEST_F(StructTest, IsValid) {
diff --git a/src/ast/switch_statement_test.cc b/src/ast/switch_statement_test.cc
index 08ea6f3..c4adb28 100644
--- a/src/ast/switch_statement_test.cc
+++ b/src/ast/switch_statement_test.cc
@@ -36,12 +36,12 @@
body.push_back(
std::make_unique<CaseStatement>(std::move(lit), StatementList()));
- auto ident_ptr = ident.get();
- auto case_ptr = body[0].get();
+ auto* ident_ptr = ident.get();
+ auto* case_ptr = body[0].get();
SwitchStatement stmt(std::move(ident), std::move(body));
EXPECT_EQ(stmt.condition(), ident_ptr);
- ASSERT_EQ(stmt.body().size(), 1);
+ ASSERT_EQ(stmt.body().size(), 1u);
EXPECT_EQ(stmt.body()[0].get(), case_ptr);
}
@@ -50,8 +50,8 @@
SwitchStatement stmt(Source{20, 2}, std::move(ident), CaseStatementList());
auto src = stmt.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(SwitchStatementTest, IsSwitch) {
diff --git a/src/ast/type/array_type_test.cc b/src/ast/type/array_type_test.cc
index 4751641..b7ff819 100644
--- a/src/ast/type/array_type_test.cc
+++ b/src/ast/type/array_type_test.cc
@@ -29,7 +29,7 @@
U32Type u32;
ArrayType arr{&u32, 3};
EXPECT_EQ(arr.type(), &u32);
- EXPECT_EQ(arr.size(), 3);
+ EXPECT_EQ(arr.size(), 3u);
EXPECT_TRUE(arr.IsArray());
EXPECT_FALSE(arr.IsRuntimeArray());
}
@@ -38,7 +38,7 @@
U32Type u32;
ArrayType arr{&u32};
EXPECT_EQ(arr.type(), &u32);
- EXPECT_EQ(arr.size(), 0);
+ EXPECT_EQ(arr.size(), 0u);
EXPECT_TRUE(arr.IsArray());
EXPECT_TRUE(arr.IsRuntimeArray());
}
diff --git a/src/ast/type/matrix_type_test.cc b/src/ast/type/matrix_type_test.cc
index 1babb7d..4fcd024 100644
--- a/src/ast/type/matrix_type_test.cc
+++ b/src/ast/type/matrix_type_test.cc
@@ -28,8 +28,8 @@
I32Type i32;
MatrixType m{&i32, 2, 4};
EXPECT_EQ(m.type(), &i32);
- EXPECT_EQ(m.rows(), 2);
- EXPECT_EQ(m.columns(), 4);
+ EXPECT_EQ(m.rows(), 2u);
+ EXPECT_EQ(m.columns(), 4u);
}
TEST_F(MatrixTypeTest, Is) {
diff --git a/src/ast/type/struct_type_test.cc b/src/ast/type/struct_type_test.cc
index 6492a15..5c3c65e 100644
--- a/src/ast/type/struct_type_test.cc
+++ b/src/ast/type/struct_type_test.cc
@@ -28,7 +28,7 @@
TEST_F(StructTypeTest, Creation) {
auto impl = std::make_unique<Struct>();
- auto ptr = impl.get();
+ auto* ptr = impl.get();
StructType s{std::move(impl)};
EXPECT_EQ(s.impl(), ptr);
}
diff --git a/src/ast/type/vector_type_test.cc b/src/ast/type/vector_type_test.cc
index cd2ce3a..b4fd515 100644
--- a/src/ast/type/vector_type_test.cc
+++ b/src/ast/type/vector_type_test.cc
@@ -28,7 +28,7 @@
I32Type i32;
VectorType v{&i32, 2};
EXPECT_EQ(v.type(), &i32);
- EXPECT_EQ(v.size(), 2);
+ EXPECT_EQ(v.size(), 2u);
}
TEST_F(VectorTypeTest, Is) {
diff --git a/src/ast/type_constructor_expression_test.cc b/src/ast/type_constructor_expression_test.cc
index ad4e01a..28b3608 100644
--- a/src/ast/type_constructor_expression_test.cc
+++ b/src/ast/type_constructor_expression_test.cc
@@ -33,11 +33,11 @@
type::F32Type f32;
ExpressionList expr;
expr.push_back(std::make_unique<IdentifierExpression>("expr"));
- auto expr_ptr = expr[0].get();
+ auto* expr_ptr = expr[0].get();
TypeConstructorExpression t(&f32, std::move(expr));
EXPECT_EQ(t.type(), &f32);
- ASSERT_EQ(t.values().size(), 1);
+ ASSERT_EQ(t.values().size(), 1u);
EXPECT_EQ(t.values()[0].get(), expr_ptr);
}
@@ -48,8 +48,8 @@
TypeConstructorExpression t(Source{20, 2}, &f32, std::move(expr));
auto src = t.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(TypeConstructorExpressionTest, IsTypeConstructor) {
diff --git a/src/ast/uint_literal_test.cc b/src/ast/uint_literal_test.cc
index d19811c..a1402b3 100644
--- a/src/ast/uint_literal_test.cc
+++ b/src/ast/uint_literal_test.cc
@@ -27,7 +27,7 @@
ast::type::U32Type u32;
UintLiteral u{&u32, 47};
ASSERT_TRUE(u.IsUint());
- EXPECT_EQ(u.value(), 47);
+ EXPECT_EQ(u.value(), 47u);
}
TEST_F(UintLiteralTest, Is) {
diff --git a/src/ast/unary_derivative_expression_test.cc b/src/ast/unary_derivative_expression_test.cc
index 6a9d3661..96d1e46 100644
--- a/src/ast/unary_derivative_expression_test.cc
+++ b/src/ast/unary_derivative_expression_test.cc
@@ -27,7 +27,7 @@
TEST_F(UnaryDerivativeExpressionTest, Creation) {
auto ident = std::make_unique<IdentifierExpression>("ident");
- auto ident_ptr = ident.get();
+ auto* ident_ptr = ident.get();
UnaryDerivativeExpression d(UnaryDerivative::kDpdy,
DerivativeModifier::kCoarse, std::move(ident));
@@ -42,8 +42,8 @@
UnaryDerivativeExpression d(Source{20, 2}, UnaryDerivative::kDpdy,
DerivativeModifier::kCoarse, std::move(ident));
auto src = d.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(UnaryDerivativeExpressionTest, IsUnaryDerivative) {
diff --git a/src/ast/unary_method_expression_test.cc b/src/ast/unary_method_expression_test.cc
index 92f265e..1a2d9ed 100644
--- a/src/ast/unary_method_expression_test.cc
+++ b/src/ast/unary_method_expression_test.cc
@@ -30,11 +30,11 @@
ExpressionList params;
params.push_back(std::make_unique<IdentifierExpression>("ident"));
- auto ident_ptr = params[0].get();
+ auto* ident_ptr = params[0].get();
UnaryMethodExpression u(UnaryMethod::kAll, std::move(params));
EXPECT_EQ(u.op(), UnaryMethod::kAll);
- ASSERT_EQ(u.params().size(), 1);
+ ASSERT_EQ(u.params().size(), 1u);
EXPECT_EQ(u.params()[0].get(), ident_ptr);
}
@@ -44,8 +44,8 @@
UnaryMethodExpression u(Source{20, 2}, UnaryMethod::kAll, std::move(params));
auto src = u.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(UnaryMethodExpressionTest, IsUnaryMethod) {
diff --git a/src/ast/unary_op_expression_test.cc b/src/ast/unary_op_expression_test.cc
index 93462bb..1d5e319 100644
--- a/src/ast/unary_op_expression_test.cc
+++ b/src/ast/unary_op_expression_test.cc
@@ -27,7 +27,7 @@
TEST_F(UnaryOpExpressionTest, Creation) {
auto ident = std::make_unique<IdentifierExpression>("ident");
- auto ident_ptr = ident.get();
+ auto* ident_ptr = ident.get();
UnaryOpExpression u(UnaryOp::kNot, std::move(ident));
EXPECT_EQ(u.op(), UnaryOp::kNot);
@@ -38,8 +38,8 @@
auto ident = std::make_unique<IdentifierExpression>("ident");
UnaryOpExpression u(Source{20, 2}, UnaryOp::kNot, std::move(ident));
auto src = u.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(UnaryOpExpressionTest, IsUnaryOp) {
diff --git a/src/ast/unless_statement_test.cc b/src/ast/unless_statement_test.cc
index 6937f9b..45b7b7d 100644
--- a/src/ast/unless_statement_test.cc
+++ b/src/ast/unless_statement_test.cc
@@ -30,12 +30,12 @@
StatementList body;
body.push_back(std::make_unique<NopStatement>());
- auto ident_ptr = ident.get();
- auto nop_ptr = body[0].get();
+ auto* ident_ptr = ident.get();
+ auto* nop_ptr = body[0].get();
UnlessStatement u(std::move(ident), std::move(body));
EXPECT_EQ(u.condition(), ident_ptr);
- ASSERT_EQ(u.body().size(), 1);
+ ASSERT_EQ(u.body().size(), 1u);
EXPECT_EQ(u.body()[0].get(), nop_ptr);
}
@@ -46,8 +46,8 @@
UnlessStatement u(Source{20, 2}, std::move(ident), std::move(body));
auto src = u.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(UnlessStatementTest, IsUnless) {
diff --git a/src/ast/variable_decl_statement_test.cc b/src/ast/variable_decl_statement_test.cc
index 84149c1..d96b07b 100644
--- a/src/ast/variable_decl_statement_test.cc
+++ b/src/ast/variable_decl_statement_test.cc
@@ -27,7 +27,7 @@
TEST_F(VariableDeclStatementTest, Creation) {
type::F32Type f32;
auto var = std::make_unique<Variable>("a", StorageClass::kNone, &f32);
- auto var_ptr = var.get();
+ auto* var_ptr = var.get();
VariableDeclStatement stmt(std::move(var));
EXPECT_EQ(stmt.variable(), var_ptr);
@@ -39,8 +39,8 @@
VariableDeclStatement stmt(Source{20, 2}, std::move(var));
auto src = stmt.source();
- EXPECT_EQ(src.line, 20);
- EXPECT_EQ(src.column, 2);
+ EXPECT_EQ(src.line, 20u);
+ EXPECT_EQ(src.column, 2u);
}
TEST_F(VariableDeclStatementTest, IsVariableDecl) {
diff --git a/src/ast/variable_test.cc b/src/ast/variable_test.cc
index 1e4b72c..fd0db76 100644
--- a/src/ast/variable_test.cc
+++ b/src/ast/variable_test.cc
@@ -32,8 +32,8 @@
EXPECT_EQ(v.name(), "my_var");
EXPECT_EQ(v.storage_class(), StorageClass::kFunction);
EXPECT_EQ(v.type(), &t);
- EXPECT_EQ(v.line(), 0);
- EXPECT_EQ(v.column(), 0);
+ EXPECT_EQ(v.line(), 0u);
+ EXPECT_EQ(v.column(), 0u);
}
TEST_F(VariableTest, CreationWithSource) {
@@ -44,8 +44,8 @@
EXPECT_EQ(v.name(), "i");
EXPECT_EQ(v.storage_class(), StorageClass::kPrivate);
EXPECT_EQ(v.type(), &t);
- EXPECT_EQ(v.line(), 27);
- EXPECT_EQ(v.column(), 4);
+ EXPECT_EQ(v.line(), 27u);
+ EXPECT_EQ(v.column(), 4u);
}
TEST_F(VariableTest, CreationEmpty) {
@@ -61,8 +61,8 @@
EXPECT_EQ(v.name(), "a_var");
EXPECT_EQ(v.storage_class(), StorageClass::kWorkgroup);
EXPECT_EQ(v.type(), &t);
- EXPECT_EQ(v.line(), 27);
- EXPECT_EQ(v.column(), 4);
+ EXPECT_EQ(v.line(), 27u);
+ EXPECT_EQ(v.column(), 4u);
}
TEST_F(VariableTest, IsValid) {
diff --git a/src/reader/spirv/function_arithmetic_test.cc b/src/reader/spirv/function_arithmetic_test.cc
index b2945af..a0ccf6e 100644
--- a/src/reader/spirv/function_arithmetic_test.cc
+++ b/src/reader/spirv/function_arithmetic_test.cc
@@ -137,7 +137,7 @@
OpReturn
OpFunctionEnd
)";
- auto p = parser(test::Assemble(assembly));
+ auto* p = parser(test::Assemble(assembly));
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
<< p->error() << "\n"
<< assembly;
diff --git a/src/reader/spirv/function_decl_test.cc b/src/reader/spirv/function_decl_test.cc
index 75cc74f..20e5b1b 100644
--- a/src/reader/spirv/function_decl_test.cc
+++ b/src/reader/spirv/function_decl_test.cc
@@ -50,7 +50,7 @@
}
TEST_F(SpvParserTest, EmitFunctionDeclaration_VoidFunctionWithoutParams) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
%entry = OpLabel
OpReturn
@@ -67,7 +67,7 @@
}
TEST_F(SpvParserTest, EmitFunctionDeclaration_NonVoidResultType) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%fn_ret_float = OpTypeFunction %float
%100 = OpFunction %float None %fn_ret_float
%entry = OpLabel
@@ -86,7 +86,7 @@
}
TEST_F(SpvParserTest, EmitFunctionDeclaration_MixedParamTypes) {
- auto p = parser(test::Assemble(Names({"a", "b", "c"}) + CommonTypes() + R"(
+ auto* p = parser(test::Assemble(Names({"a", "b", "c"}) + CommonTypes() + R"(
%fn_mixed_params = OpTypeFunction %float %uint %float %int
%100 = OpFunction %void None %fn_mixed_params
@@ -125,7 +125,7 @@
}
TEST_F(SpvParserTest, EmitFunctionDeclaration_GenerateParamNames) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%fn_mixed_params = OpTypeFunction %float %uint %float %int
%100 = OpFunction %void None %fn_mixed_params
diff --git a/src/reader/spirv/function_logical_test.cc b/src/reader/spirv/function_logical_test.cc
index 7f58959..a3e0b36 100644
--- a/src/reader/spirv/function_logical_test.cc
+++ b/src/reader/spirv/function_logical_test.cc
@@ -159,7 +159,7 @@
OpReturn
OpFunctionEnd
)";
- auto p = parser(test::Assemble(assembly));
+ auto* p = parser(test::Assemble(assembly));
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
<< p->error() << "\n"
<< assembly;
diff --git a/src/reader/spirv/function_memory_test.cc b/src/reader/spirv/function_memory_test.cc
index 9b96018..aafc6cb 100644
--- a/src/reader/spirv/function_memory_test.cc
+++ b/src/reader/spirv/function_memory_test.cc
@@ -29,7 +29,7 @@
using ::testing::HasSubstr;
TEST_F(SpvParserTest, EmitStatement_StoreBoolConst) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%void = OpTypeVoid
%voidfn = OpTypeFunction %void
%ty = OpTypeBool
@@ -64,7 +64,7 @@
}
TEST_F(SpvParserTest, EmitStatement_StoreUintConst) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%void = OpTypeVoid
%voidfn = OpTypeFunction %void
%ty = OpTypeInt 32 0
@@ -92,7 +92,7 @@
}
TEST_F(SpvParserTest, EmitStatement_StoreIntConst) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%void = OpTypeVoid
%voidfn = OpTypeFunction %void
%ty = OpTypeInt 32 1
@@ -120,7 +120,7 @@
}
TEST_F(SpvParserTest, EmitStatement_StoreFloatConst) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%void = OpTypeVoid
%voidfn = OpTypeFunction %void
%ty = OpTypeFloat 32
@@ -148,7 +148,7 @@
}
TEST_F(SpvParserTest, EmitStatement_LoadBool) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%void = OpTypeVoid
%voidfn = OpTypeFunction %void
%ty = OpTypeBool
@@ -178,7 +178,7 @@
}
TEST_F(SpvParserTest, EmitStatement_LoadScalar) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%void = OpTypeVoid
%voidfn = OpTypeFunction %void
%ty = OpTypeInt 32 0
@@ -218,7 +218,7 @@
}
TEST_F(SpvParserTest, EmitStatement_UseLoadedScalarTwice) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%void = OpTypeVoid
%voidfn = OpTypeFunction %void
%ty = OpTypeInt 32 0
@@ -258,7 +258,7 @@
}
TEST_F(SpvParserTest, EmitStatement_StoreToModuleScopeVar) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%void = OpTypeVoid
%voidfn = OpTypeFunction %void
%ty = OpTypeInt 32 0
diff --git a/src/reader/spirv/function_var_test.cc b/src/reader/spirv/function_var_test.cc
index c53c036..1f929a7 100644
--- a/src/reader/spirv/function_var_test.cc
+++ b/src/reader/spirv/function_var_test.cc
@@ -70,7 +70,7 @@
}
TEST_F(SpvParserTest, EmitFunctionVariables_AnonymousVars) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
%entry = OpLabel
%1 = OpVariable %ptr_uint Function
@@ -108,7 +108,7 @@
}
TEST_F(SpvParserTest, EmitFunctionVariables_NamedVars) {
- auto p = parser(test::Assemble(Names({"a", "b", "c"}) + CommonTypes() + R"(
+ auto* p = parser(test::Assemble(Names({"a", "b", "c"}) + CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
%entry = OpLabel
%a = OpVariable %ptr_uint Function
@@ -146,7 +146,7 @@
}
TEST_F(SpvParserTest, EmitFunctionVariables_MixedTypes) {
- auto p = parser(test::Assemble(Names({"a", "b", "c"}) + CommonTypes() + R"(
+ auto* p = parser(test::Assemble(Names({"a", "b", "c"}) + CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
%entry = OpLabel
%a = OpVariable %ptr_uint Function
@@ -184,7 +184,7 @@
}
TEST_F(SpvParserTest, EmitFunctionVariables_ScalarInitializers) {
- auto p = parser(
+ auto* p = parser(
test::Assemble(Names({"a", "b", "c", "d", "e"}) + CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
%entry = OpLabel
@@ -254,7 +254,7 @@
}
TEST_F(SpvParserTest, EmitFunctionVariables_ScalarNullInitializers) {
- auto p =
+ auto* p =
parser(test::Assemble(Names({"a", "b", "c", "d"}) + CommonTypes() + R"(
%null_bool = OpConstantNull %bool
%null_int = OpConstantNull %int
@@ -318,7 +318,7 @@
}
TEST_F(SpvParserTest, EmitFunctionVariables_VectorInitializer) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%ptr = OpTypePointer Function %v2float
%two = OpConstant %float 2.0
%const = OpConstantComposite %v2float %float_1p5 %two
@@ -351,7 +351,7 @@
}
TEST_F(SpvParserTest, EmitFunctionVariables_MatrixInitializer) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%ptr = OpTypePointer Function %m3v2float
%two = OpConstant %float 2.0
%three = OpConstant %float 3.0
@@ -402,7 +402,7 @@
}
TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%ptr = OpTypePointer Function %arr2uint
%two = OpConstant %uint 2
%const = OpConstantComposite %arr2uint %uint_1 %two
@@ -435,7 +435,7 @@
}
TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%ptr = OpTypePointer Function %strct
%two = OpConstant %uint 2
%arrconst = OpConstantComposite %arr2uint %uint_1 %two
diff --git a/src/reader/spirv/parser_impl_convert_member_decoration_test.cc b/src/reader/spirv/parser_impl_convert_member_decoration_test.cc
index d8351a8..19a93a4 100644
--- a/src/reader/spirv/parser_impl_convert_member_decoration_test.cc
+++ b/src/reader/spirv/parser_impl_convert_member_decoration_test.cc
@@ -32,7 +32,7 @@
using ::testing::Eq;
TEST_F(SpvParserTest, ConvertMemberDecoration_Empty) {
- auto p = parser(std::vector<uint32_t>{});
+ auto* p = parser(std::vector<uint32_t>{});
auto result = p->ConvertMemberDecoration({});
EXPECT_EQ(result.get(), nullptr);
@@ -40,7 +40,7 @@
}
TEST_F(SpvParserTest, ConvertMemberDecoration_OffsetWithoutOperand) {
- auto p = parser(std::vector<uint32_t>{});
+ auto* p = parser(std::vector<uint32_t>{});
auto result = p->ConvertMemberDecoration({SpvDecorationOffset});
EXPECT_EQ(result.get(), nullptr);
@@ -50,7 +50,7 @@
}
TEST_F(SpvParserTest, ConvertMemberDecoration_OffsetWithTooManyOperands) {
- auto p = parser(std::vector<uint32_t>{});
+ auto* p = parser(std::vector<uint32_t>{});
auto result = p->ConvertMemberDecoration({SpvDecorationOffset, 3, 4});
EXPECT_EQ(result.get(), nullptr);
@@ -60,19 +60,19 @@
}
TEST_F(SpvParserTest, ConvertMemberDecoration_Offset) {
- auto p = parser(std::vector<uint32_t>{});
+ auto* p = parser(std::vector<uint32_t>{});
auto result = p->ConvertMemberDecoration({SpvDecorationOffset, 8});
ASSERT_NE(result.get(), nullptr);
EXPECT_TRUE(result->IsOffset());
auto* offset_deco = result->AsOffset();
ASSERT_NE(offset_deco, nullptr);
- EXPECT_EQ(offset_deco->offset(), 8);
+ EXPECT_EQ(offset_deco->offset(), 8u);
EXPECT_TRUE(p->error().empty());
}
TEST_F(SpvParserTest, ConvertMemberDecoration_UnhandledDecoration) {
- auto p = parser(std::vector<uint32_t>{});
+ auto* p = parser(std::vector<uint32_t>{});
auto result = p->ConvertMemberDecoration({12345678});
EXPECT_EQ(result.get(), nullptr);
diff --git a/src/reader/spirv/parser_impl_convert_type_test.cc b/src/reader/spirv/parser_impl_convert_type_test.cc
index aa0fe09..75746ad 100644
--- a/src/reader/spirv/parser_impl_convert_type_test.cc
+++ b/src/reader/spirv/parser_impl_convert_type_test.cc
@@ -37,7 +37,7 @@
using ::testing::Eq;
TEST_F(SpvParserTest, ConvertType_PreservesExistingFailure) {
- auto p = parser(std::vector<uint32_t>{});
+ auto* p = parser(std::vector<uint32_t>{});
p->Fail() << "boing";
auto* type = p->ConvertType(10);
EXPECT_EQ(type, nullptr);
@@ -45,7 +45,7 @@
}
TEST_F(SpvParserTest, ConvertType_RequiresInternalRepresntation) {
- auto p = parser(std::vector<uint32_t>{});
+ auto* p = parser(std::vector<uint32_t>{});
auto* type = p->ConvertType(10);
EXPECT_EQ(type, nullptr);
EXPECT_THAT(
@@ -54,7 +54,7 @@
}
TEST_F(SpvParserTest, ConvertType_NotAnId) {
- auto p = parser(test::Assemble("%1 = OpExtInstImport \"GLSL.std.450\""));
+ auto* p = parser(test::Assemble("%1 = OpExtInstImport \"GLSL.std.450\""));
EXPECT_TRUE(p->BuildInternalModule());
auto* type = p->ConvertType(10);
@@ -64,7 +64,7 @@
}
TEST_F(SpvParserTest, ConvertType_IdExistsButIsNotAType) {
- auto p = parser(test::Assemble("%1 = OpExtInstImport \"GLSL.std.450\""));
+ auto* p = parser(test::Assemble("%1 = OpExtInstImport \"GLSL.std.450\""));
EXPECT_TRUE(p->BuildInternalModule());
auto* type = p->ConvertType(1);
@@ -74,7 +74,7 @@
TEST_F(SpvParserTest, ConvertType_UnhandledType) {
// Pipes are an OpenCL type. Tint doesn't support them.
- auto p = parser(test::Assemble("%70 = OpTypePipe WriteOnly"));
+ auto* p = parser(test::Assemble("%70 = OpTypePipe WriteOnly"));
EXPECT_TRUE(p->BuildInternalModule());
auto* type = p->ConvertType(70);
@@ -83,7 +83,7 @@
}
TEST_F(SpvParserTest, ConvertType_Void) {
- auto p = parser(test::Assemble("%1 = OpTypeVoid"));
+ auto* p = parser(test::Assemble("%1 = OpTypeVoid"));
EXPECT_TRUE(p->BuildInternalModule());
auto* type = p->ConvertType(1);
@@ -92,7 +92,7 @@
}
TEST_F(SpvParserTest, ConvertType_Bool) {
- auto p = parser(test::Assemble("%100 = OpTypeBool"));
+ auto* p = parser(test::Assemble("%100 = OpTypeBool"));
EXPECT_TRUE(p->BuildInternalModule());
auto* type = p->ConvertType(100);
@@ -101,7 +101,7 @@
}
TEST_F(SpvParserTest, ConvertType_I32) {
- auto p = parser(test::Assemble("%2 = OpTypeInt 32 1"));
+ auto* p = parser(test::Assemble("%2 = OpTypeInt 32 1"));
EXPECT_TRUE(p->BuildInternalModule());
auto* type = p->ConvertType(2);
@@ -110,7 +110,7 @@
}
TEST_F(SpvParserTest, ConvertType_U32) {
- auto p = parser(test::Assemble("%3 = OpTypeInt 32 0"));
+ auto* p = parser(test::Assemble("%3 = OpTypeInt 32 0"));
EXPECT_TRUE(p->BuildInternalModule());
auto* type = p->ConvertType(3);
@@ -119,7 +119,7 @@
}
TEST_F(SpvParserTest, ConvertType_F32) {
- auto p = parser(test::Assemble("%4 = OpTypeFloat 32"));
+ auto* p = parser(test::Assemble("%4 = OpTypeFloat 32"));
EXPECT_TRUE(p->BuildInternalModule());
auto* type = p->ConvertType(4);
@@ -128,7 +128,7 @@
}
TEST_F(SpvParserTest, ConvertType_BadIntWidth) {
- auto p = parser(test::Assemble("%5 = OpTypeInt 17 1"));
+ auto* p = parser(test::Assemble("%5 = OpTypeInt 17 1"));
EXPECT_TRUE(p->BuildInternalModule());
auto* type = p->ConvertType(5);
@@ -137,7 +137,7 @@
}
TEST_F(SpvParserTest, ConvertType_BadFloatWidth) {
- auto p = parser(test::Assemble("%6 = OpTypeFloat 19"));
+ auto* p = parser(test::Assemble("%6 = OpTypeFloat 19"));
EXPECT_TRUE(p->BuildInternalModule());
auto* type = p->ConvertType(6);
@@ -146,7 +146,7 @@
}
TEST_F(SpvParserTest, DISABLED_ConvertType_InvalidVectorElement) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%5 = OpTypePipe ReadOnly
%20 = OpTypeVector %5 2
)"));
@@ -158,7 +158,7 @@
}
TEST_F(SpvParserTest, ConvertType_VecOverF32) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%20 = OpTypeVector %float 2
%30 = OpTypeVector %float 3
@@ -185,7 +185,7 @@
}
TEST_F(SpvParserTest, ConvertType_VecOverI32) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%int = OpTypeInt 32 1
%20 = OpTypeVector %int 2
%30 = OpTypeVector %int 3
@@ -212,7 +212,7 @@
}
TEST_F(SpvParserTest, ConvertType_VecOverU32) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%uint = OpTypeInt 32 0
%20 = OpTypeVector %uint 2
%30 = OpTypeVector %uint 3
@@ -239,7 +239,7 @@
}
TEST_F(SpvParserTest, DISABLED_ConvertType_InvalidMatrixElement) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%5 = OpTypePipe ReadOnly
%10 = OpTypeVector %5 2
%20 = OpTypeMatrix %10 2
@@ -253,7 +253,7 @@
TEST_F(SpvParserTest, ConvertType_MatrixOverF32) {
// Matrices are only defined over floats.
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%v2 = OpTypeVector %float 2
%v3 = OpTypeVector %float 3
@@ -275,62 +275,62 @@
auto* m22 = p->ConvertType(22);
EXPECT_TRUE(m22->IsMatrix());
EXPECT_TRUE(m22->AsMatrix()->type()->IsF32());
- EXPECT_EQ(m22->AsMatrix()->rows(), 2);
- EXPECT_EQ(m22->AsMatrix()->columns(), 2);
+ EXPECT_EQ(m22->AsMatrix()->rows(), 2u);
+ EXPECT_EQ(m22->AsMatrix()->columns(), 2u);
auto* m23 = p->ConvertType(23);
EXPECT_TRUE(m23->IsMatrix());
EXPECT_TRUE(m23->AsMatrix()->type()->IsF32());
- EXPECT_EQ(m23->AsMatrix()->rows(), 2);
- EXPECT_EQ(m23->AsMatrix()->columns(), 3);
+ EXPECT_EQ(m23->AsMatrix()->rows(), 2u);
+ EXPECT_EQ(m23->AsMatrix()->columns(), 3u);
auto* m24 = p->ConvertType(24);
EXPECT_TRUE(m24->IsMatrix());
EXPECT_TRUE(m24->AsMatrix()->type()->IsF32());
- EXPECT_EQ(m24->AsMatrix()->rows(), 2);
- EXPECT_EQ(m24->AsMatrix()->columns(), 4);
+ EXPECT_EQ(m24->AsMatrix()->rows(), 2u);
+ EXPECT_EQ(m24->AsMatrix()->columns(), 4u);
auto* m32 = p->ConvertType(32);
EXPECT_TRUE(m32->IsMatrix());
EXPECT_TRUE(m32->AsMatrix()->type()->IsF32());
- EXPECT_EQ(m32->AsMatrix()->rows(), 3);
- EXPECT_EQ(m32->AsMatrix()->columns(), 2);
+ EXPECT_EQ(m32->AsMatrix()->rows(), 3u);
+ EXPECT_EQ(m32->AsMatrix()->columns(), 2u);
auto* m33 = p->ConvertType(33);
EXPECT_TRUE(m33->IsMatrix());
EXPECT_TRUE(m33->AsMatrix()->type()->IsF32());
- EXPECT_EQ(m33->AsMatrix()->rows(), 3);
- EXPECT_EQ(m33->AsMatrix()->columns(), 3);
+ EXPECT_EQ(m33->AsMatrix()->rows(), 3u);
+ EXPECT_EQ(m33->AsMatrix()->columns(), 3u);
auto* m34 = p->ConvertType(34);
EXPECT_TRUE(m34->IsMatrix());
EXPECT_TRUE(m34->AsMatrix()->type()->IsF32());
- EXPECT_EQ(m34->AsMatrix()->rows(), 3);
- EXPECT_EQ(m34->AsMatrix()->columns(), 4);
+ EXPECT_EQ(m34->AsMatrix()->rows(), 3u);
+ EXPECT_EQ(m34->AsMatrix()->columns(), 4u);
auto* m42 = p->ConvertType(42);
EXPECT_TRUE(m42->IsMatrix());
EXPECT_TRUE(m42->AsMatrix()->type()->IsF32());
- EXPECT_EQ(m42->AsMatrix()->rows(), 4);
- EXPECT_EQ(m42->AsMatrix()->columns(), 2);
+ EXPECT_EQ(m42->AsMatrix()->rows(), 4u);
+ EXPECT_EQ(m42->AsMatrix()->columns(), 2u);
auto* m43 = p->ConvertType(43);
EXPECT_TRUE(m43->IsMatrix());
EXPECT_TRUE(m43->AsMatrix()->type()->IsF32());
- EXPECT_EQ(m43->AsMatrix()->rows(), 4);
- EXPECT_EQ(m43->AsMatrix()->columns(), 3);
+ EXPECT_EQ(m43->AsMatrix()->rows(), 4u);
+ EXPECT_EQ(m43->AsMatrix()->columns(), 3u);
auto* m44 = p->ConvertType(44);
EXPECT_TRUE(m44->IsMatrix());
EXPECT_TRUE(m44->AsMatrix()->type()->IsF32());
- EXPECT_EQ(m44->AsMatrix()->rows(), 4);
- EXPECT_EQ(m44->AsMatrix()->columns(), 4);
+ EXPECT_EQ(m44->AsMatrix()->rows(), 4u);
+ EXPECT_EQ(m44->AsMatrix()->columns(), 4u);
EXPECT_TRUE(p->error().empty());
}
TEST_F(SpvParserTest, ConvertType_RuntimeArray) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%uint = OpTypeInt 32 0
%10 = OpTypeRuntimeArray %uint
)"));
@@ -350,7 +350,7 @@
}
TEST_F(SpvParserTest, ConvertType_Array) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%uint = OpTypeInt 32 0
%uint_42 = OpConstant %uint 42
%10 = OpTypeArray %uint %uint_42
@@ -371,7 +371,7 @@
}
TEST_F(SpvParserTest, ConvertType_ArrayBadLengthIsSpecConstantValue) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpDecorate %uint_42 SpecId 12
%uint = OpTypeInt 32 0
%uint_42 = OpSpecConstant %uint 42
@@ -386,7 +386,7 @@
}
TEST_F(SpvParserTest, ConvertType_ArrayBadLengthIsSpecConstantExpr) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%uint = OpTypeInt 32 0
%uint_42 = OpConstant %uint 42
%sum = OpSpecConstantOp %uint IAdd %uint_42 %uint_42
@@ -405,7 +405,7 @@
// optimizer representation doesn't handle it and asserts out instead.
TEST_F(SpvParserTest, ConvertType_ArrayBadTooBig) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%uint64 = OpTypeInt 64 0
%uint64_big = OpConstant %uint64 5000000000
%10 = OpTypeArray %uint64 %uint64_big
@@ -420,7 +420,7 @@
}
TEST_F(SpvParserTest, ConvertType_StructTwoMembers) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%uint = OpTypeInt 32 0
%float = OpTypeFloat 32
%10 = OpTypeStruct %uint %float
@@ -441,7 +441,7 @@
}
TEST_F(SpvParserTest, ConvertType_StructWithBlockDecoration) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpDecorate %10 Block
%uint = OpTypeInt 32 0
%10 = OpTypeStruct %uint
@@ -461,7 +461,7 @@
}
TEST_F(SpvParserTest, ConvertType_StructWithMemberDecorations) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpMemberDecorate %10 0 Offset 0
OpMemberDecorate %10 1 Offset 8
OpMemberDecorate %10 2 Offset 16
@@ -493,7 +493,7 @@
TEST_F(SpvParserTest, ConvertType_InvalidPointeetype) {
// Disallow pointer-to-function
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%void = OpTypeVoid
%42 = OpTypeFunction %void
%3 = OpTypePointer Input %42
@@ -508,7 +508,7 @@
TEST_F(SpvParserTest, DISABLED_ConvertType_InvalidStorageClass) {
// Disallow invalid storage class
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%1 = OpTypeFloat 32
%3 = OpTypePointer !999 %1 ; Special syntax to inject 999 as the storage class
)"));
@@ -517,7 +517,7 @@
}
TEST_F(SpvParserTest, ConvertType_PointerInput) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%3 = OpTypePointer Input %float
)"));
@@ -533,7 +533,7 @@
}
TEST_F(SpvParserTest, ConvertType_PointerOutput) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%3 = OpTypePointer Output %float
)"));
@@ -549,7 +549,7 @@
}
TEST_F(SpvParserTest, ConvertType_PointerUniform) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%3 = OpTypePointer Uniform %float
)"));
@@ -565,7 +565,7 @@
}
TEST_F(SpvParserTest, ConvertType_PointerWorkgroup) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%3 = OpTypePointer Workgroup %float
)"));
@@ -581,7 +581,7 @@
}
TEST_F(SpvParserTest, ConvertType_PointerUniformConstant) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%3 = OpTypePointer UniformConstant %float
)"));
@@ -597,7 +597,7 @@
}
TEST_F(SpvParserTest, ConvertType_PointerStorageBuffer) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%3 = OpTypePointer StorageBuffer %float
)"));
@@ -613,7 +613,7 @@
}
TEST_F(SpvParserTest, ConvertType_PointerImage) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%3 = OpTypePointer Image %float
)"));
@@ -629,7 +629,7 @@
}
TEST_F(SpvParserTest, ConvertType_PointerPushConstant) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%3 = OpTypePointer PushConstant %float
)"));
@@ -645,7 +645,7 @@
}
TEST_F(SpvParserTest, ConvertType_PointerPrivate) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%3 = OpTypePointer Private %float
)"));
@@ -661,7 +661,7 @@
}
TEST_F(SpvParserTest, ConvertType_PointerFunction) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%3 = OpTypePointer Function %float
)"));
@@ -678,7 +678,7 @@
TEST_F(SpvParserTest, ConvertType_PointerToPointer) {
// FYI: The reader suports pointer-to-pointer even while WebGPU does not.
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%42 = OpTypePointer Output %float
%3 = OpTypePointer Input %42
diff --git a/src/reader/spirv/parser_impl_entry_point_test.cc b/src/reader/spirv/parser_impl_entry_point_test.cc
index c216b3b..998f0cf 100644
--- a/src/reader/spirv/parser_impl_entry_point_test.cc
+++ b/src/reader/spirv/parser_impl_entry_point_test.cc
@@ -35,7 +35,7 @@
}
TEST_F(SpvParserTest, EntryPoint_NoEntryPoint) {
- auto p = parser(test::Assemble(""));
+ auto* p = parser(test::Assemble(""));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_TRUE(p->error().empty());
const auto module_ast = p->module().to_str();
@@ -43,7 +43,7 @@
}
TEST_F(SpvParserTest, EntryPoint_Vertex) {
- auto p = parser(test::Assemble(MakeEntryPoint("Vertex", "foobar")));
+ auto* p = parser(test::Assemble(MakeEntryPoint("Vertex", "foobar")));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_TRUE(p->error().empty());
const auto module_str = p->module().to_str();
@@ -51,7 +51,7 @@
}
TEST_F(SpvParserTest, EntryPoint_Fragment) {
- auto p = parser(test::Assemble(MakeEntryPoint("Fragment", "blitz")));
+ auto* p = parser(test::Assemble(MakeEntryPoint("Fragment", "blitz")));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_TRUE(p->error().empty());
const auto module_str = p->module().to_str();
@@ -59,7 +59,7 @@
}
TEST_F(SpvParserTest, EntryPoint_Compute) {
- auto p = parser(test::Assemble(MakeEntryPoint("GLCompute", "sort")));
+ auto* p = parser(test::Assemble(MakeEntryPoint("GLCompute", "sort")));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_TRUE(p->error().empty());
const auto module_str = p->module().to_str();
@@ -67,9 +67,9 @@
}
TEST_F(SpvParserTest, EntryPoint_MultiNameConflict) {
- auto p = parser(test::Assemble(MakeEntryPoint("GLCompute", "work", "40") +
- MakeEntryPoint("Vertex", "work", "50") +
- MakeEntryPoint("Fragment", "work", "60")));
+ auto* p = parser(test::Assemble(MakeEntryPoint("GLCompute", "work", "40") +
+ MakeEntryPoint("Vertex", "work", "50") +
+ MakeEntryPoint("Fragment", "work", "60")));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_TRUE(p->error().empty());
const auto module_str = p->module().to_str();
@@ -79,7 +79,7 @@
}
TEST_F(SpvParserTest, EntryPoint_NameIsSanitized) {
- auto p = parser(test::Assemble(MakeEntryPoint("GLCompute", ".1234")));
+ auto* p = parser(test::Assemble(MakeEntryPoint("GLCompute", ".1234")));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_TRUE(p->error().empty());
const auto module_str = p->module().to_str();
diff --git a/src/reader/spirv/parser_impl_function_decl_test.cc b/src/reader/spirv/parser_impl_function_decl_test.cc
index 6e29906..ab6f5ab 100644
--- a/src/reader/spirv/parser_impl_function_decl_test.cc
+++ b/src/reader/spirv/parser_impl_function_decl_test.cc
@@ -50,7 +50,7 @@
}
TEST_F(SpvParserTest, EmitFunctions_NoFunctions) {
- auto p = parser(test::Assemble(CommonTypes()));
+ auto* p = parser(test::Assemble(CommonTypes()));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_TRUE(p->error().empty());
const auto module_ast = p->module().to_str();
@@ -58,7 +58,7 @@
}
TEST_F(SpvParserTest, EmitFunctions_FunctionWithoutBody) {
- auto p = parser(test::Assemble(Names({"main"}) + CommonTypes() + R"(
+ auto* p = parser(test::Assemble(Names({"main"}) + CommonTypes() + R"(
%main = OpFunction %void None %voidfn
OpFunctionEnd
)"));
@@ -69,7 +69,7 @@
}
TEST_F(SpvParserTest, EmitFunctions_VoidFunctionWithoutParams) {
- auto p = parser(test::Assemble(Names({"main"}) + CommonTypes() + R"(
+ auto* p = parser(test::Assemble(Names({"main"}) + CommonTypes() + R"(
%main = OpFunction %void None %voidfn
%entry = OpLabel
OpReturn
@@ -85,7 +85,7 @@
}
TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) {
- auto p = parser(
+ auto* p = parser(
test::Assemble(Names({"root", "branch", "leaf"}) + CommonTypes() + R"(
%root = OpFunction %void None %voidfn
%root_entry = OpLabel
@@ -123,7 +123,7 @@
}
TEST_F(SpvParserTest, EmitFunctions_NonVoidResultType) {
- auto p = parser(test::Assemble(Names({"ret_float"}) + CommonTypes() + R"(
+ auto* p = parser(test::Assemble(Names({"ret_float"}) + CommonTypes() + R"(
%fn_ret_float = OpTypeFunction %float
%ret_float = OpFunction %float None %fn_ret_float
@@ -142,8 +142,8 @@
}
TEST_F(SpvParserTest, EmitFunctions_MixedParamTypes) {
- auto p = parser(test::Assemble(Names({"mixed_params", "a", "b", "c"}) +
- CommonTypes() + R"(
+ auto* p = parser(test::Assemble(Names({"mixed_params", "a", "b", "c"}) +
+ CommonTypes() + R"(
%fn_mixed_params = OpTypeFunction %float %uint %float %int
%mixed_params = OpFunction %void None %fn_mixed_params
@@ -181,7 +181,7 @@
}
TEST_F(SpvParserTest, EmitFunctions_GenerateParamNames) {
- auto p = parser(test::Assemble(Names({"mixed_params"}) + CommonTypes() + R"(
+ auto* p = parser(test::Assemble(Names({"mixed_params"}) + CommonTypes() + R"(
%fn_mixed_params = OpTypeFunction %float %uint %float %int
%mixed_params = OpFunction %void None %fn_mixed_params
diff --git a/src/reader/spirv/parser_impl_get_decorations_test.cc b/src/reader/spirv/parser_impl_get_decorations_test.cc
index 113a7a7..542332c 100644
--- a/src/reader/spirv/parser_impl_get_decorations_test.cc
+++ b/src/reader/spirv/parser_impl_get_decorations_test.cc
@@ -27,7 +27,7 @@
using ::testing::UnorderedElementsAre;
TEST_F(SpvParserTest, GetDecorationsFor_NotAnId) {
- auto p = parser(test::Assemble(""));
+ auto* p = parser(test::Assemble(""));
EXPECT_TRUE(p->BuildAndParseInternalModule());
auto decorations = p->GetDecorationsFor(42);
EXPECT_TRUE(decorations.empty());
@@ -35,7 +35,7 @@
}
TEST_F(SpvParserTest, GetDecorationsFor_NoDecorations) {
- auto p = parser(test::Assemble("%1 = OpTypeVoid"));
+ auto* p = parser(test::Assemble("%1 = OpTypeVoid"));
EXPECT_TRUE(p->BuildAndParseInternalModule());
auto decorations = p->GetDecorationsFor(1);
EXPECT_TRUE(decorations.empty());
@@ -43,7 +43,7 @@
}
TEST_F(SpvParserTest, GetDecorationsFor_OneDecoration) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpDecorate %10 Block
%float = OpTypeFloat 32
%10 = OpTypeStruct %float
@@ -56,7 +56,7 @@
}
TEST_F(SpvParserTest, GetDecorationsFor_MultiDecoration) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpDecorate %5 RelaxedPrecision
OpDecorate %5 Location 7 ; Invalid case made up for test
%float = OpTypeFloat 32
@@ -71,7 +71,7 @@
}
TEST_F(SpvParserTest, GetDecorationsForMember_NotAnId) {
- auto p = parser(test::Assemble(""));
+ auto* p = parser(test::Assemble(""));
EXPECT_TRUE(p->BuildAndParseInternalModule());
auto decorations = p->GetDecorationsForMember(42, 9);
EXPECT_TRUE(decorations.empty());
@@ -79,7 +79,7 @@
}
TEST_F(SpvParserTest, GetDecorationsForMember_NotAStruct) {
- auto p = parser(test::Assemble("%1 = OpTypeVoid"));
+ auto* p = parser(test::Assemble("%1 = OpTypeVoid"));
EXPECT_TRUE(p->BuildAndParseInternalModule());
auto decorations = p->GetDecorationsFor(1);
EXPECT_TRUE(decorations.empty());
@@ -87,7 +87,7 @@
}
TEST_F(SpvParserTest, GetDecorationsForMember_MemberWithoutDecoration) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%uint = OpTypeInt 32 0
%10 = OpTypeStruct %uint
)"));
@@ -99,7 +99,7 @@
// TODO(dneto): Enable when ArrayStride is handled
TEST_F(SpvParserTest, DISABLED_GetDecorationsForMember_OneDecoration) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpMemberDecorate %10 1 ArrayStride 12
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
@@ -117,7 +117,7 @@
// crbug.com/tint/30 for ArrayStride
// crbug.com/tint/31 for matrix layout
TEST_F(SpvParserTest, DISABLED_GetDecorationsForMember_MultiDecoration) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpMemberDecorate %50 1 RelaxedPrecision
OpMemberDecorate %50 2 ArrayStride 16
OpMemberDecorate %50 2 MatrixStride 8
diff --git a/src/reader/spirv/parser_impl_import_test.cc b/src/reader/spirv/parser_impl_import_test.cc
index 4febd6e..afa78a3 100644
--- a/src/reader/spirv/parser_impl_import_test.cc
+++ b/src/reader/spirv/parser_impl_import_test.cc
@@ -32,7 +32,7 @@
using ::testing::UnorderedElementsAre;
TEST_F(SpvParserTest, Import_NoImport) {
- auto p = parser(test::Assemble("%1 = OpTypeVoid"));
+ auto* p = parser(test::Assemble("%1 = OpTypeVoid"));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_TRUE(p->error().empty());
const auto module_ast = p->module().to_str();
@@ -40,7 +40,7 @@
}
TEST_F(SpvParserTest, Import_ImportGlslStd450) {
- auto p = parser(test::Assemble(R"(%1 = OpExtInstImport "GLSL.std.450")"));
+ auto* p = parser(test::Assemble(R"(%1 = OpExtInstImport "GLSL.std.450")"));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_TRUE(p->error().empty());
EXPECT_THAT(p->glsl_std_450_imports(), ElementsAre(1));
@@ -49,7 +49,7 @@
}
TEST_F(SpvParserTest, Import_ImportGlslStd450Twice) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%1 = OpExtInstImport "GLSL.std.450"
%42 = OpExtInstImport "GLSL.std.450"
)"));
@@ -57,7 +57,7 @@
EXPECT_TRUE(p->error().empty());
EXPECT_THAT(p->glsl_std_450_imports(), UnorderedElementsAre(1, 42));
const auto module = p->module();
- EXPECT_EQ(module.imports().size(), 1);
+ EXPECT_EQ(module.imports().size(), 1u);
const auto module_ast = module.to_str();
// TODO(dneto): Use a matcher to show there is only one import.
EXPECT_THAT(module_ast, HasSubstr(R"(Import{"GLSL.std.450" as std::glsl})"));
diff --git a/src/reader/spirv/parser_impl_module_var_test.cc b/src/reader/spirv/parser_impl_module_var_test.cc
index 547ae00..eb60d25 100644
--- a/src/reader/spirv/parser_impl_module_var_test.cc
+++ b/src/reader/spirv/parser_impl_module_var_test.cc
@@ -59,7 +59,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_NoVar) {
- auto p = parser(test::Assemble(""));
+ auto* p = parser(test::Assemble(""));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_TRUE(p->error().empty());
const auto module_ast = p->module().to_str();
@@ -67,7 +67,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_BadStorageClass) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%ptr = OpTypePointer CrossWorkgroup %float
%52 = OpVariable %ptr CrossWorkgroup
@@ -81,7 +81,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_BadPointerType) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%fn_ty = OpTypeFunction %float
%3 = OpTypePointer Private %fn_ty
@@ -97,7 +97,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_AnonWorkgroupVar) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%float = OpTypeFloat 32
%ptr = OpTypePointer Workgroup %float
%52 = OpVariable %ptr Workgroup
@@ -115,7 +115,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_NamedWorkgroupVar) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpName %52 "the_counter"
%float = OpTypeFloat 32
%ptr = OpTypePointer Workgroup %float
@@ -134,7 +134,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_PrivateVar) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpName %52 "my_own_private_idaho"
%float = OpTypeFloat 32
%ptr = OpTypePointer Private %float
@@ -153,7 +153,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_BuiltinVerteIndex) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpDecorate %52 BuiltIn VertexIndex
%uint = OpTypeInt 32 0
%ptr = OpTypePointer Input %uint
@@ -175,7 +175,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_ScalarInitializers) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%1 = OpVariable %ptr_bool Private %true
%2 = OpVariable %ptr_bool Private %false
%3 = OpVariable %ptr_int Private %int_m1
@@ -228,7 +228,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_ScalarNullInitializers) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%null_bool = OpConstantNull %bool
%null_int = OpConstantNull %int
%null_uint = OpConstantNull %uint
@@ -277,7 +277,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_VectorInitializer) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%ptr = OpTypePointer Private %v2float
%two = OpConstant %float 2.0
%const = OpConstantComposite %v2float %float_1p5 %two
@@ -301,7 +301,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_MatrixInitializer) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%ptr = OpTypePointer Private %m3v2float
%two = OpConstant %float 2.0
%three = OpConstant %float 3.0
@@ -343,7 +343,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_ArrayInitializer) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%ptr = OpTypePointer Private %arr2uint
%two = OpConstant %uint 2
%const = OpConstantComposite %arr2uint %uint_1 %two
@@ -367,7 +367,7 @@
}
TEST_F(SpvParserTest, ModuleScopeVar_StructInitializer) {
- auto p = parser(test::Assemble(CommonTypes() + R"(
+ auto* p = parser(test::Assemble(CommonTypes() + R"(
%ptr = OpTypePointer Private %strct
%two = OpConstant %uint 2
%arrconst = OpConstantComposite %arr2uint %uint_1 %two
diff --git a/src/reader/spirv/parser_impl_named_types_test.cc b/src/reader/spirv/parser_impl_named_types_test.cc
index cebfa10..0c6ba73 100644
--- a/src/reader/spirv/parser_impl_named_types_test.cc
+++ b/src/reader/spirv/parser_impl_named_types_test.cc
@@ -35,7 +35,7 @@
using ::testing::HasSubstr;
TEST_F(SpvParserTest, NamedTypes_AnonStruct) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%uint = OpTypeInt 32 0
%s = OpTypeStruct %uint %uint
)"));
@@ -44,7 +44,7 @@
}
TEST_F(SpvParserTest, NamedTypes_NamedStruct) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpName %s "mystruct"
%uint = OpTypeInt 32 0
%s = OpTypeStruct %uint %uint
@@ -55,7 +55,7 @@
// TODO(dneto): Enable this when array types can have ArrayStride
TEST_F(SpvParserTest, DISABLED_NamedTypes_AnonArrayWithDecoration) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpDecorate %arr ArrayStride 16
%uint = OpTypeInt 32 0
%uint_3 = OpConstant %uint 3
@@ -69,7 +69,7 @@
// an OpName?
TEST_F(SpvParserTest, NamedTypes_AnonRTArray) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%uint = OpTypeInt 32 0
%arr = OpTypeRuntimeArray %uint
)"));
@@ -78,7 +78,7 @@
}
TEST_F(SpvParserTest, NamedTypes_NamedRTArray) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpName %arr "myrtarr"
%uint = OpTypeInt 32 0
%arr = OpTypeRuntimeArray %uint
diff --git a/src/reader/spirv/parser_impl_test.cc b/src/reader/spirv/parser_impl_test.cc
index 94e944e..fe8114a 100644
--- a/src/reader/spirv/parser_impl_test.cc
+++ b/src/reader/spirv/parser_impl_test.cc
@@ -30,14 +30,14 @@
TEST_F(SpvParserTest, Impl_Uint32VecEmpty) {
std::vector<uint32_t> data;
- auto p = parser(data);
+ auto* p = parser(data);
EXPECT_FALSE(p->Parse());
// TODO(dneto): What message?
}
TEST_F(SpvParserTest, Impl_InvalidModuleFails) {
auto invalid_spv = test::Assemble("%ty = OpTypeInt 3 0");
- auto p = parser(invalid_spv);
+ auto* p = parser(invalid_spv);
EXPECT_FALSE(p->Parse());
EXPECT_THAT(
p->error(),
diff --git a/src/reader/spirv/parser_impl_test_helper.h b/src/reader/spirv/parser_impl_test_helper.h
index 4e98d26..18132ef 100644
--- a/src/reader/spirv/parser_impl_test_helper.h
+++ b/src/reader/spirv/parser_impl_test_helper.h
@@ -37,10 +37,10 @@
~SpvParserTestBase() = default;
/// Sets up the test helper
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
/// Tears down the test helper
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
/// Retrieves the parser from the helper
/// @param input the SPIR-V binary to parse
diff --git a/src/reader/spirv/parser_impl_user_name_test.cc b/src/reader/spirv/parser_impl_user_name_test.cc
index ebe2761..acbe71e 100644
--- a/src/reader/spirv/parser_impl_user_name_test.cc
+++ b/src/reader/spirv/parser_impl_user_name_test.cc
@@ -28,7 +28,7 @@
using ::testing::Eq;
TEST_F(SpvParserTest, UserName_RespectOpName) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpName %1 "the_void_type"
%1 = OpTypeVoid
)"));
@@ -37,7 +37,7 @@
}
TEST_F(SpvParserTest, UserName_DistinguishDuplicateSuggestion) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpName %1 "vanilla"
OpName %2 "vanilla"
%1 = OpTypeVoid
@@ -49,7 +49,7 @@
}
TEST_F(SpvParserTest, UserName_RespectOpMemberName) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpMemberName %3 0 "strawberry"
OpMemberName %3 1 "vanilla"
OpMemberName %3 2 "chocolate"
@@ -63,7 +63,7 @@
}
TEST_F(SpvParserTest, UserName_SynthesizeMemberNames) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
%2 = OpTypeInt 32 0
%3 = OpTypeStruct %2 %2 %2
)"));
@@ -74,7 +74,7 @@
}
TEST_F(SpvParserTest, UserName_MemberNamesMixUserAndSynthesized) {
- auto p = parser(test::Assemble(R"(
+ auto* p = parser(test::Assemble(R"(
OpMemberName %3 1 "vanilla"
%2 = OpTypeInt 32 0
%3 = OpTypeStruct %2 %2 %2
diff --git a/src/reader/wgsl/lexer_test.cc b/src/reader/wgsl/lexer_test.cc
index 29b5ee2..3d7027f 100644
--- a/src/reader/wgsl/lexer_test.cc
+++ b/src/reader/wgsl/lexer_test.cc
@@ -36,8 +36,8 @@
auto t = l.next();
EXPECT_TRUE(t.IsIdentifier());
- EXPECT_EQ(t.line(), 2);
- EXPECT_EQ(t.column(), 6);
+ EXPECT_EQ(t.line(), 2u);
+ EXPECT_EQ(t.column(), 6u);
EXPECT_EQ(t.to_str(), "ident");
t = l.next();
@@ -52,14 +52,14 @@
auto t = l.next();
EXPECT_TRUE(t.IsIdentifier());
- EXPECT_EQ(t.line(), 2);
- EXPECT_EQ(t.column(), 1);
+ EXPECT_EQ(t.line(), 2u);
+ EXPECT_EQ(t.column(), 1u);
EXPECT_EQ(t.to_str(), "ident1");
t = l.next();
EXPECT_TRUE(t.IsIdentifier());
- EXPECT_EQ(t.line(), 4);
- EXPECT_EQ(t.column(), 2);
+ EXPECT_EQ(t.line(), 4u);
+ EXPECT_EQ(t.column(), 2u);
EXPECT_EQ(t.to_str(), "ident2");
t = l.next();
@@ -72,20 +72,20 @@
auto t = l.next();
EXPECT_TRUE(t.IsIdentifier());
EXPECT_EQ(t.to_str(), "id");
- EXPECT_EQ(1, t.line());
- EXPECT_EQ(1, t.column());
+ EXPECT_EQ(1u, t.line());
+ EXPECT_EQ(1u, t.column());
t = l.next();
EXPECT_TRUE(t.IsStringLiteral());
EXPECT_EQ(t.to_str(), "this is string content");
- EXPECT_EQ(1, t.line());
- EXPECT_EQ(4, t.column());
+ EXPECT_EQ(1u, t.line());
+ EXPECT_EQ(4u, t.column());
t = l.next();
EXPECT_TRUE(t.IsIdentifier());
EXPECT_EQ(t.to_str(), "id2");
- EXPECT_EQ(1, t.line());
- EXPECT_EQ(29, t.column());
+ EXPECT_EQ(1u, t.line());
+ EXPECT_EQ(29u, t.column());
}
TEST_F(LexerTest, StringTest_Unterminated) {
@@ -94,8 +94,8 @@
auto t = l.next();
EXPECT_TRUE(t.IsIdentifier());
EXPECT_EQ(t.to_str(), "id");
- EXPECT_EQ(1, t.line());
- EXPECT_EQ(1, t.column());
+ EXPECT_EQ(1u, t.line());
+ EXPECT_EQ(1u, t.column());
t = l.next();
EXPECT_TRUE(t.IsStringLiteral());
@@ -121,8 +121,8 @@
auto t = l.next();
EXPECT_TRUE(t.IsFloatLiteral());
EXPECT_EQ(t.to_f32(), params.result);
- EXPECT_EQ(1, t.line());
- EXPECT_EQ(1, t.column());
+ EXPECT_EQ(1u, t.line());
+ EXPECT_EQ(1u, t.column());
t = l.next();
EXPECT_TRUE(t.IsEof());
@@ -170,8 +170,8 @@
auto t = l.next();
EXPECT_TRUE(t.IsIdentifier());
- EXPECT_EQ(t.line(), 1);
- EXPECT_EQ(t.column(), 1);
+ EXPECT_EQ(t.line(), 1u);
+ EXPECT_EQ(t.column(), 1u);
EXPECT_EQ(t.to_str(), GetParam());
}
INSTANTIATE_TEST_SUITE_P(
@@ -202,8 +202,8 @@
auto t = l.next();
EXPECT_TRUE(t.IsIntLiteral());
- EXPECT_EQ(t.line(), 1);
- EXPECT_EQ(t.column(), 1);
+ EXPECT_EQ(t.line(), 1u);
+ EXPECT_EQ(t.column(), 1u);
EXPECT_EQ(t.to_i32(), params.result);
}
INSTANTIATE_TEST_SUITE_P(
@@ -246,8 +246,8 @@
auto t = l.next();
EXPECT_TRUE(t.IsUintLiteral());
- EXPECT_EQ(t.line(), 1);
- EXPECT_EQ(t.column(), 1);
+ EXPECT_EQ(t.line(), 1u);
+ EXPECT_EQ(t.column(), 1u);
EXPECT_EQ(t.to_u32(), params.result);
}
INSTANTIATE_TEST_SUITE_P(
@@ -284,8 +284,8 @@
auto t = l.next();
EXPECT_TRUE(t.IsUintLiteral());
EXPECT_EQ(t.to_u32(), params.result);
- EXPECT_EQ(1, t.line());
- EXPECT_EQ(1, t.column());
+ EXPECT_EQ(1u, t.line());
+ EXPECT_EQ(1u, t.column());
}
INSTANTIATE_TEST_SUITE_P(LexerTest,
IntegerTest_Unsigned,
@@ -310,8 +310,8 @@
auto t = l.next();
EXPECT_TRUE(t.IsIntLiteral());
EXPECT_EQ(t.to_i32(), params.result);
- EXPECT_EQ(1, t.line());
- EXPECT_EQ(1, t.column());
+ EXPECT_EQ(1u, t.line());
+ EXPECT_EQ(1u, t.column());
}
INSTANTIATE_TEST_SUITE_P(
LexerTest,
@@ -350,8 +350,8 @@
auto t = l.next();
EXPECT_TRUE(t.Is(params.type));
- EXPECT_EQ(1, t.line());
- EXPECT_EQ(1, t.column());
+ EXPECT_EQ(1u, t.line());
+ EXPECT_EQ(1u, t.column());
t = l.next();
EXPECT_EQ(1 + std::string(params.input).size(), t.column());
@@ -399,8 +399,8 @@
auto t = l.next();
EXPECT_TRUE(t.Is(params.type));
- EXPECT_EQ(1, t.line());
- EXPECT_EQ(1, t.column());
+ EXPECT_EQ(1u, t.line());
+ EXPECT_EQ(1u, t.column());
t = l.next();
EXPECT_EQ(1 + std::string(params.input).size(), t.column());
@@ -500,7 +500,7 @@
using KeywordTest_Reserved = testing::TestWithParam<const char*>;
TEST_P(KeywordTest_Reserved, Parses) {
- auto keyword = GetParam();
+ auto* keyword = GetParam();
Lexer l(keyword);
auto t = l.next();
diff --git a/src/reader/wgsl/parser_impl_additive_expression_test.cc b/src/reader/wgsl/parser_impl_additive_expression_test.cc
index 38d92ea..25c772a 100644
--- a/src/reader/wgsl/parser_impl_additive_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_additive_expression_test.cc
@@ -26,58 +26,58 @@
namespace {
TEST_F(ParserImplTest, AdditiveExpression_Parses_Plus) {
- auto p = parser("a + true");
+ auto* p = parser("a + true");
auto e = p->additive_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kAdd, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, AdditiveExpression_Parses_Minus) {
- auto p = parser("a - true");
+ auto* p = parser("a - true");
auto e = p->additive_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kSubtract, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, AdditiveExpression_InvalidLHS) {
- auto p = parser("if (a) {} + true");
+ auto* p = parser("if (a) {} + true");
auto e = p->additive_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, nullptr);
}
TEST_F(ParserImplTest, AdditiveExpression_InvalidRHS) {
- auto p = parser("true + if (a) {}");
+ auto* p = parser("true + if (a) {}");
auto e = p->additive_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -85,7 +85,7 @@
}
TEST_F(ParserImplTest, AdditiveExpression_NoOr_ReturnsLHS) {
- auto p = parser("a true");
+ auto* p = parser("a true");
auto e = p->additive_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_and_expression_test.cc b/src/reader/wgsl/parser_impl_and_expression_test.cc
index 49ef84a..d708267 100644
--- a/src/reader/wgsl/parser_impl_and_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_and_expression_test.cc
@@ -26,36 +26,36 @@
namespace {
TEST_F(ParserImplTest, AndExpression_Parses) {
- auto p = parser("a & true");
+ auto* p = parser("a & true");
auto e = p->and_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kAnd, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, AndExpression_InvalidLHS) {
- auto p = parser("if (a) {} & true");
+ auto* p = parser("if (a) {} & true");
auto e = p->and_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, nullptr);
}
TEST_F(ParserImplTest, AndExpression_InvalidRHS) {
- auto p = parser("true & if (a) {}");
+ auto* p = parser("true & if (a) {}");
auto e = p->and_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -63,7 +63,7 @@
}
TEST_F(ParserImplTest, AndExpression_NoOr_ReturnsLHS) {
- auto p = parser("a true");
+ auto* p = parser("a true");
auto e = p->and_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_argument_expression_list_test.cc b/src/reader/wgsl/parser_impl_argument_expression_list_test.cc
index 650ff96..4061b11 100644
--- a/src/reader/wgsl/parser_impl_argument_expression_list_test.cc
+++ b/src/reader/wgsl/parser_impl_argument_expression_list_test.cc
@@ -29,34 +29,34 @@
namespace {
TEST_F(ParserImplTest, ArgumentExpressionList_Parses) {
- auto p = parser("a");
+ auto* p = parser("a");
auto e = p->argument_expression_list();
ASSERT_FALSE(p->has_error()) << p->error();
- ASSERT_EQ(e.size(), 1);
+ ASSERT_EQ(e.size(), 1u);
ASSERT_TRUE(e[0]->IsIdentifier());
}
TEST_F(ParserImplTest, ArgumentExpressionList_ParsesMultiple) {
- auto p = parser("a, -33, 1+2");
+ auto* p = parser("a, -33, 1+2");
auto e = p->argument_expression_list();
ASSERT_FALSE(p->has_error()) << p->error();
- ASSERT_EQ(e.size(), 3);
+ ASSERT_EQ(e.size(), 3u);
ASSERT_TRUE(e[0]->IsIdentifier());
ASSERT_TRUE(e[1]->IsConstructor());
ASSERT_TRUE(e[2]->IsBinary());
}
TEST_F(ParserImplTest, ArgumentExpressionList_HandlesMissingExpression) {
- auto p = parser("a, ");
+ auto* p = parser("a, ");
auto e = p->argument_expression_list();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:4: unable to parse argument expression after comma");
}
TEST_F(ParserImplTest, ArgumentExpressionList_HandlesInvalidExpression) {
- auto p = parser("if(a) {}");
+ auto* p = parser("if(a) {}");
auto e = p->argument_expression_list();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:1: unable to parse argument expression");
diff --git a/src/reader/wgsl/parser_impl_assignment_stmt_test.cc b/src/reader/wgsl/parser_impl_assignment_stmt_test.cc
index b4cc88d..581b62b 100644
--- a/src/reader/wgsl/parser_impl_assignment_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_assignment_stmt_test.cc
@@ -29,7 +29,7 @@
namespace {
TEST_F(ParserImplTest, AssignmentStmt_Parses_ToVariable) {
- auto p = parser("a = 123");
+ auto* p = parser("a = 123");
auto e = p->assignment_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -39,21 +39,21 @@
ASSERT_NE(e->rhs(), nullptr);
ASSERT_TRUE(e->lhs()->IsIdentifier());
- auto ident = e->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = e->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(e->rhs()->IsConstructor());
ASSERT_TRUE(e->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = e->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = e->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_NE(init->literal(), nullptr);
ASSERT_TRUE(init->literal()->IsInt());
EXPECT_EQ(init->literal()->AsInt()->value(), 123);
}
TEST_F(ParserImplTest, AssignmentStmt_Parses_ToMember) {
- auto p = parser("a.b.c[2].d = 123");
+ auto* p = parser("a.b.c[2].d = 123");
auto e = p->assignment_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -64,21 +64,21 @@
ASSERT_TRUE(e->rhs()->IsConstructor());
ASSERT_TRUE(e->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = e->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = e->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_NE(init->literal(), nullptr);
ASSERT_TRUE(init->literal()->IsInt());
EXPECT_EQ(init->literal()->AsInt()->value(), 123);
ASSERT_TRUE(e->lhs()->IsMemberAccessor());
- auto mem = e->lhs()->AsMemberAccessor();
+ auto* mem = e->lhs()->AsMemberAccessor();
ASSERT_TRUE(mem->member()->IsIdentifier());
- auto ident = mem->member()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = mem->member()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "d");
ASSERT_TRUE(mem->structure()->IsArrayAccessor());
- auto ary = mem->structure()->AsArrayAccessor();
+ auto* ary = mem->structure()->AsArrayAccessor();
ASSERT_TRUE(ary->idx_expr()->IsConstructor());
ASSERT_TRUE(ary->idx_expr()->AsConstructor()->IsScalarConstructor());
@@ -91,7 +91,7 @@
mem = ary->array()->AsMemberAccessor();
ASSERT_TRUE(mem->member()->IsIdentifier());
ident = mem->member()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "c");
ASSERT_TRUE(mem->structure()->IsMemberAccessor());
@@ -99,17 +99,17 @@
ASSERT_TRUE(mem->structure()->IsIdentifier());
ident = mem->structure()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(mem->member()->IsIdentifier());
ident = mem->member()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "b");
}
TEST_F(ParserImplTest, AssignmentStmt_MissingEqual) {
- auto p = parser("a.b.c[2].d 123");
+ auto* p = parser("a.b.c[2].d 123");
auto e = p->assignment_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -117,14 +117,14 @@
}
TEST_F(ParserImplTest, AssignmentStmt_InvalidLHS) {
- auto p = parser("if (true) {} = 123");
+ auto* p = parser("if (true) {} = 123");
auto e = p->assignment_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, nullptr);
}
TEST_F(ParserImplTest, AssignmentStmt_InvalidRHS) {
- auto p = parser("a.b.c[2].d = if (true) {}");
+ auto* p = parser("a.b.c[2].d = if (true) {}");
auto e = p->assignment_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_body_stmt_test.cc b/src/reader/wgsl/parser_impl_body_stmt_test.cc
index a92a001..6f16508 100644
--- a/src/reader/wgsl/parser_impl_body_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_body_stmt_test.cc
@@ -22,35 +22,35 @@
namespace {
TEST_F(ParserImplTest, BodyStmt) {
- auto p = parser(R"({
+ auto* p = parser(R"({
kill;
nop;
return 1 + b / 2;
})");
auto e = p->body_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
- ASSERT_EQ(e.size(), 3);
+ ASSERT_EQ(e.size(), 3u);
EXPECT_TRUE(e[0]->IsKill());
EXPECT_TRUE(e[1]->IsNop());
EXPECT_TRUE(e[2]->IsReturn());
}
TEST_F(ParserImplTest, BodyStmt_Empty) {
- auto p = parser("{}");
+ auto* p = parser("{}");
auto e = p->body_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
- EXPECT_EQ(e.size(), 0);
+ EXPECT_EQ(e.size(), 0u);
}
TEST_F(ParserImplTest, BodyStmt_InvalidStmt) {
- auto p = parser("{fn main() -> void {}}");
+ auto* p = parser("{fn main() -> void {}}");
auto e = p->body_stmt();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:2: missing }");
}
TEST_F(ParserImplTest, BodyStmt_MissingRightParen) {
- auto p = parser("{return;");
+ auto* p = parser("{return;");
auto e = p->body_stmt();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:9: missing }");
diff --git a/src/reader/wgsl/parser_impl_break_stmt_test.cc b/src/reader/wgsl/parser_impl_break_stmt_test.cc
index 688c5b8..45ff183 100644
--- a/src/reader/wgsl/parser_impl_break_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_break_stmt_test.cc
@@ -25,7 +25,7 @@
namespace {
TEST_F(ParserImplTest, BreakStmt) {
- auto p = parser("break");
+ auto* p = parser("break");
auto e = p->break_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -35,7 +35,7 @@
}
TEST_F(ParserImplTest, BreakStmt_WithIf) {
- auto p = parser("break if (a == b)");
+ auto* p = parser("break if (a == b)");
auto e = p->break_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -46,7 +46,7 @@
}
TEST_F(ParserImplTest, BreakStmt_WithUnless) {
- auto p = parser("break unless (a == b)");
+ auto* p = parser("break unless (a == b)");
auto e = p->break_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -57,7 +57,7 @@
}
TEST_F(ParserImplTest, BreakStmt_InvalidRHS) {
- auto p = parser("break if (a = b)");
+ auto* p = parser("break if (a = b)");
auto e = p->break_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -65,7 +65,7 @@
}
TEST_F(ParserImplTest, BreakStmt_MissingRHS) {
- auto p = parser("break if");
+ auto* p = parser("break if");
auto e = p->break_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_builtin_decoration_test.cc b/src/reader/wgsl/parser_impl_builtin_decoration_test.cc
index 47cb2f8..7a4cb92 100644
--- a/src/reader/wgsl/parser_impl_builtin_decoration_test.cc
+++ b/src/reader/wgsl/parser_impl_builtin_decoration_test.cc
@@ -36,9 +36,9 @@
BuiltinTest() = default;
~BuiltinTest() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -52,7 +52,7 @@
TEST_P(BuiltinTest, Parses) {
auto params = GetParam();
- auto p = parser(params.input);
+ auto* p = parser(params.input);
auto builtin = p->builtin_decoration();
ASSERT_FALSE(p->has_error());
@@ -79,7 +79,7 @@
ast::Builtin::kGlobalInvocationId}));
TEST_F(ParserImplTest, BuiltinDecoration_NoMatch) {
- auto p = parser("not-a-builtin");
+ auto* p = parser("not-a-builtin");
auto builtin = p->builtin_decoration();
ASSERT_EQ(builtin, ast::Builtin::kNone);
diff --git a/src/reader/wgsl/parser_impl_case_body_test.cc b/src/reader/wgsl/parser_impl_case_body_test.cc
index d02a599..8196c5b 100644
--- a/src/reader/wgsl/parser_impl_case_body_test.cc
+++ b/src/reader/wgsl/parser_impl_case_body_test.cc
@@ -22,45 +22,45 @@
namespace {
TEST_F(ParserImplTest, CaseBody_Empty) {
- auto p = parser("");
+ auto* p = parser("");
auto e = p->case_body();
ASSERT_FALSE(p->has_error()) << p->error();
- EXPECT_EQ(e.size(), 0);
+ EXPECT_EQ(e.size(), 0u);
}
TEST_F(ParserImplTest, CaseBody_Statements) {
- auto p = parser(R"(
+ auto* p = parser(R"(
var a: i32;
a = 2;)");
auto e = p->case_body();
ASSERT_FALSE(p->has_error()) << p->error();
- ASSERT_EQ(e.size(), 2);
+ ASSERT_EQ(e.size(), 2u);
EXPECT_TRUE(e[0]->IsVariableDecl());
EXPECT_TRUE(e[1]->IsAssign());
}
TEST_F(ParserImplTest, CaseBody_InvalidStatement) {
- auto p = parser("a =");
+ auto* p = parser("a =");
auto e = p->case_body();
ASSERT_TRUE(p->has_error());
- EXPECT_EQ(e.size(), 0);
+ EXPECT_EQ(e.size(), 0u);
EXPECT_EQ(p->error(), "1:4: unable to parse right side of assignment");
}
TEST_F(ParserImplTest, CaseBody_Fallthrough) {
- auto p = parser("fallthrough;");
+ auto* p = parser("fallthrough;");
auto e = p->case_body();
ASSERT_FALSE(p->has_error()) << p->error();
- ASSERT_EQ(e.size(), 1);
+ ASSERT_EQ(e.size(), 1u);
EXPECT_TRUE(e[0]->IsFallthrough());
}
TEST_F(ParserImplTest, CaseBody_Fallthrough_MissingSemicolon) {
- auto p = parser("fallthrough");
+ auto* p = parser("fallthrough");
auto e = p->case_body();
ASSERT_TRUE(p->has_error());
- EXPECT_EQ(e.size(), 0);
+ EXPECT_EQ(e.size(), 0u);
EXPECT_EQ(p->error(), "1:12: missing ;");
}
diff --git a/src/reader/wgsl/parser_impl_const_expr_test.cc b/src/reader/wgsl/parser_impl_const_expr_test.cc
index ca18fcf..4f4ecbc 100644
--- a/src/reader/wgsl/parser_impl_const_expr_test.cc
+++ b/src/reader/wgsl/parser_impl_const_expr_test.cc
@@ -27,23 +27,23 @@
namespace {
TEST_F(ParserImplTest, ConstExpr_TypeDecl) {
- auto p = parser("vec2<f32>(1., 2.)");
+ auto* p = parser("vec2<f32>(1., 2.)");
auto e = p->const_expr();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsConstructor());
ASSERT_TRUE(e->AsConstructor()->IsTypeConstructor());
- auto t = e->AsConstructor()->AsTypeConstructor();
+ auto* t = e->AsConstructor()->AsTypeConstructor();
ASSERT_TRUE(t->type()->IsVector());
- EXPECT_EQ(t->type()->AsVector()->size(), 2);
+ EXPECT_EQ(t->type()->AsVector()->size(), 2u);
- ASSERT_EQ(t->values().size(), 2);
+ ASSERT_EQ(t->values().size(), 2u);
auto& v = t->values();
ASSERT_TRUE(v[0]->IsConstructor());
ASSERT_TRUE(v[0]->AsConstructor()->IsScalarConstructor());
- auto c = v[0]->AsConstructor()->AsScalarConstructor();
+ auto* c = v[0]->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(c->literal()->IsFloat());
EXPECT_FLOAT_EQ(c->literal()->AsFloat()->value(), 1.);
@@ -55,7 +55,7 @@
}
TEST_F(ParserImplTest, ConstExpr_TypeDecl_MissingRightParen) {
- auto p = parser("vec2<f32>(1., 2.");
+ auto* p = parser("vec2<f32>(1., 2.");
auto e = p->const_expr();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -63,7 +63,7 @@
}
TEST_F(ParserImplTest, ConstExpr_TypeDecl_MissingLeftParen) {
- auto p = parser("vec2<f32> 1., 2.)");
+ auto* p = parser("vec2<f32> 1., 2.)");
auto e = p->const_expr();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -71,7 +71,7 @@
}
TEST_F(ParserImplTest, ConstExpr_TypeDecl_HangingComma) {
- auto p = parser("vec2<f32>(1.,)");
+ auto* p = parser("vec2<f32>(1.,)");
auto e = p->const_expr();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -79,7 +79,7 @@
}
TEST_F(ParserImplTest, ConstExpr_TypeDecl_MissingComma) {
- auto p = parser("vec2<f32>(1. 2.");
+ auto* p = parser("vec2<f32>(1. 2.");
auto e = p->const_expr();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -87,7 +87,7 @@
}
TEST_F(ParserImplTest, ConstExpr_MissingExpr) {
- auto p = parser("vec2<f32>()");
+ auto* p = parser("vec2<f32>()");
auto e = p->const_expr();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -95,7 +95,7 @@
}
TEST_F(ParserImplTest, ConstExpr_InvalidExpr) {
- auto p = parser("vec2<f32>(1., if(a) {})");
+ auto* p = parser("vec2<f32>(1., if(a) {})");
auto e = p->const_expr();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -103,19 +103,19 @@
}
TEST_F(ParserImplTest, ConstExpr_ConstLiteral) {
- auto p = parser("true");
+ auto* p = parser("true");
auto e = p->const_expr();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsConstructor());
ASSERT_TRUE(e->AsConstructor()->IsScalarConstructor());
- auto c = e->AsConstructor()->AsScalarConstructor();
+ auto* c = e->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(c->literal()->IsBool());
EXPECT_TRUE(c->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, ConstExpr_ConstLiteral_Invalid) {
- auto p = parser("invalid");
+ auto* p = parser("invalid");
auto e = p->const_expr();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_const_literal_test.cc b/src/reader/wgsl/parser_impl_const_literal_test.cc
index ed474d9..fec1ad9 100644
--- a/src/reader/wgsl/parser_impl_const_literal_test.cc
+++ b/src/reader/wgsl/parser_impl_const_literal_test.cc
@@ -26,7 +26,7 @@
namespace {
TEST_F(ParserImplTest, ConstLiteral_Int) {
- auto p = parser("-234");
+ auto* p = parser("-234");
auto c = p->const_literal();
ASSERT_FALSE(p->has_error());
ASSERT_NE(c, nullptr);
@@ -35,7 +35,7 @@
}
TEST_F(ParserImplTest, ConstLiteral_Uint) {
- auto p = parser("234u");
+ auto* p = parser("234u");
auto c = p->const_literal();
ASSERT_FALSE(p->has_error());
ASSERT_NE(c, nullptr);
@@ -44,7 +44,7 @@
}
TEST_F(ParserImplTest, ConstLiteral_Float) {
- auto p = parser("234.e12");
+ auto* p = parser("234.e12");
auto c = p->const_literal();
ASSERT_FALSE(p->has_error());
ASSERT_NE(c, nullptr);
@@ -53,13 +53,13 @@
}
TEST_F(ParserImplTest, ConstLiteral_InvalidFloat) {
- auto p = parser("1.2e+256");
+ auto* p = parser("1.2e+256");
auto c = p->const_literal();
ASSERT_EQ(c, nullptr);
}
TEST_F(ParserImplTest, ConstLiteral_True) {
- auto p = parser("true");
+ auto* p = parser("true");
auto c = p->const_literal();
ASSERT_FALSE(p->has_error());
ASSERT_NE(c, nullptr);
@@ -68,7 +68,7 @@
}
TEST_F(ParserImplTest, ConstLiteral_False) {
- auto p = parser("false");
+ auto* p = parser("false");
auto c = p->const_literal();
ASSERT_FALSE(p->has_error());
ASSERT_NE(c, nullptr);
@@ -77,7 +77,7 @@
}
TEST_F(ParserImplTest, ConstLiteral_NoMatch) {
- auto p = parser("another-token");
+ auto* p = parser("another-token");
auto c = p->const_literal();
ASSERT_FALSE(p->has_error());
ASSERT_EQ(c, nullptr);
diff --git a/src/reader/wgsl/parser_impl_continue_stmt_test.cc b/src/reader/wgsl/parser_impl_continue_stmt_test.cc
index f1e05c2..9a7b6fa 100644
--- a/src/reader/wgsl/parser_impl_continue_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_continue_stmt_test.cc
@@ -25,7 +25,7 @@
namespace {
TEST_F(ParserImplTest, ContinueStmt) {
- auto p = parser("continue");
+ auto* p = parser("continue");
auto e = p->continue_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -35,7 +35,7 @@
}
TEST_F(ParserImplTest, ContinueStmt_WithIf) {
- auto p = parser("continue if (a == b)");
+ auto* p = parser("continue if (a == b)");
auto e = p->continue_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -46,7 +46,7 @@
}
TEST_F(ParserImplTest, ContinueStmt_WithUnless) {
- auto p = parser("continue unless (a == b)");
+ auto* p = parser("continue unless (a == b)");
auto e = p->continue_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -57,7 +57,7 @@
}
TEST_F(ParserImplTest, ContinueStmt_InvalidRHS) {
- auto p = parser("continue if (a = b)");
+ auto* p = parser("continue if (a = b)");
auto e = p->continue_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -65,7 +65,7 @@
}
TEST_F(ParserImplTest, ContinueStmt_MissingRHS) {
- auto p = parser("continue if");
+ auto* p = parser("continue if");
auto e = p->continue_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_continuing_stmt_test.cc b/src/reader/wgsl/parser_impl_continuing_stmt_test.cc
index b83fcf8..c996c84 100644
--- a/src/reader/wgsl/parser_impl_continuing_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_continuing_stmt_test.cc
@@ -22,18 +22,18 @@
namespace {
TEST_F(ParserImplTest, ContinuingStmt) {
- auto p = parser("continuing { nop; }");
+ auto* p = parser("continuing { nop; }");
auto e = p->continuing_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
- ASSERT_EQ(e.size(), 1);
+ ASSERT_EQ(e.size(), 1u);
ASSERT_TRUE(e[0]->IsNop());
}
TEST_F(ParserImplTest, ContinuingStmt_InvalidBody) {
- auto p = parser("continuing { nop }");
+ auto* p = parser("continuing { nop }");
auto e = p->continuing_stmt();
ASSERT_TRUE(p->has_error());
- ASSERT_EQ(e.size(), 0);
+ ASSERT_EQ(e.size(), 0u);
EXPECT_EQ(p->error(), "1:18: missing ;");
}
diff --git a/src/reader/wgsl/parser_impl_derivative_modifier_test.cc b/src/reader/wgsl/parser_impl_derivative_modifier_test.cc
index 72e88f4..a559258 100644
--- a/src/reader/wgsl/parser_impl_derivative_modifier_test.cc
+++ b/src/reader/wgsl/parser_impl_derivative_modifier_test.cc
@@ -38,9 +38,9 @@
DerivativeModifierTest() = default;
~DerivativeModifierTest() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -54,7 +54,7 @@
TEST_P(DerivativeModifierTest, Parses) {
auto params = GetParam();
- auto p = parser(params.input);
+ auto* p = parser(params.input);
auto mod = p->derivative_modifier();
ASSERT_FALSE(p->has_error());
@@ -71,7 +71,7 @@
DerivativeModifierData{"coarse", ast::DerivativeModifier::kCoarse}));
TEST_F(ParserImplTest, DerivativeModifier_NoMatch) {
- auto p = parser("not-a-modifier");
+ auto* p = parser("not-a-modifier");
auto stage = p->derivative_modifier();
ASSERT_EQ(stage, ast::DerivativeModifier::kNone);
diff --git a/src/reader/wgsl/parser_impl_else_stmt_test.cc b/src/reader/wgsl/parser_impl_else_stmt_test.cc
index 6de2169..377f997 100644
--- a/src/reader/wgsl/parser_impl_else_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_else_stmt_test.cc
@@ -23,17 +23,17 @@
namespace {
TEST_F(ParserImplTest, ElseStmt) {
- auto p = parser("else { a = b; c = d; }");
+ auto* p = parser("else { a = b; c = d; }");
auto e = p->else_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsElse());
ASSERT_EQ(e->condition(), nullptr);
- EXPECT_EQ(e->body().size(), 2);
+ EXPECT_EQ(e->body().size(), 2u);
}
TEST_F(ParserImplTest, ElseStmt_InvalidBody) {
- auto p = parser("else { fn main() -> void {}}");
+ auto* p = parser("else { fn main() -> void {}}");
auto e = p->else_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -41,7 +41,7 @@
}
TEST_F(ParserImplTest, ElseStmt_MissingBody) {
- auto p = parser("else");
+ auto* p = parser("else");
auto e = p->else_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_elseif_stmt_test.cc b/src/reader/wgsl/parser_impl_elseif_stmt_test.cc
index 147b3d4..578006c 100644
--- a/src/reader/wgsl/parser_impl_elseif_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_elseif_stmt_test.cc
@@ -23,43 +23,43 @@
namespace {
TEST_F(ParserImplTest, ElseIfStmt) {
- auto p = parser("elseif (a == 4) { a = b; c = d; }");
+ auto* p = parser("elseif (a == 4) { a = b; c = d; }");
auto e = p->elseif_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
- ASSERT_EQ(e.size(), 1);
+ ASSERT_EQ(e.size(), 1u);
ASSERT_TRUE(e[0]->IsElse());
ASSERT_NE(e[0]->condition(), nullptr);
ASSERT_TRUE(e[0]->condition()->IsBinary());
- EXPECT_EQ(e[0]->body().size(), 2);
+ EXPECT_EQ(e[0]->body().size(), 2u);
}
TEST_F(ParserImplTest, ElseIfStmt_Multiple) {
- auto p = parser("elseif (a == 4) { a = b; c = d; } elseif(c) { d = 2; }");
+ auto* p = parser("elseif (a == 4) { a = b; c = d; } elseif(c) { d = 2; }");
auto e = p->elseif_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
- ASSERT_EQ(e.size(), 2);
+ ASSERT_EQ(e.size(), 2u);
ASSERT_TRUE(e[0]->IsElse());
ASSERT_NE(e[0]->condition(), nullptr);
ASSERT_TRUE(e[0]->condition()->IsBinary());
- EXPECT_EQ(e[0]->body().size(), 2);
+ EXPECT_EQ(e[0]->body().size(), 2u);
ASSERT_TRUE(e[1]->IsElse());
ASSERT_NE(e[1]->condition(), nullptr);
ASSERT_TRUE(e[1]->condition()->IsIdentifier());
- EXPECT_EQ(e[1]->body().size(), 1);
+ EXPECT_EQ(e[1]->body().size(), 1u);
}
TEST_F(ParserImplTest, ElseIfStmt_InvalidBody) {
- auto p = parser("elseif (true) { fn main() -> void {}}");
+ auto* p = parser("elseif (true) { fn main() -> void {}}");
auto e = p->elseif_stmt();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:17: missing }");
}
TEST_F(ParserImplTest, ElseIfStmt_MissingBody) {
- auto p = parser("elseif (true)");
+ auto* p = parser("elseif (true)");
auto e = p->elseif_stmt();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:14: missing {");
diff --git a/src/reader/wgsl/parser_impl_entry_point_decl_test.cc b/src/reader/wgsl/parser_impl_entry_point_decl_test.cc
index 774cc7f..ede75b3 100644
--- a/src/reader/wgsl/parser_impl_entry_point_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_entry_point_decl_test.cc
@@ -23,7 +23,7 @@
namespace {
TEST_F(ParserImplTest, EntryPoint_Parses) {
- auto p = parser("entry_point fragment = main");
+ auto* p = parser("entry_point fragment = main");
auto e = p->entry_point_decl();
ASSERT_NE(e, nullptr);
ASSERT_FALSE(p->has_error());
@@ -33,7 +33,7 @@
}
TEST_F(ParserImplTest, EntryPoint_ParsesWithStringName) {
- auto p = parser(R"(entry_point vertex as "main" = vtx_main)");
+ auto* p = parser(R"(entry_point vertex as "main" = vtx_main)");
auto e = p->entry_point_decl();
ASSERT_NE(e, nullptr);
ASSERT_FALSE(p->has_error());
@@ -43,7 +43,7 @@
}
TEST_F(ParserImplTest, EntryPoint_ParsesWithIdentName) {
- auto p = parser(R"(entry_point vertex as main = vtx_main)");
+ auto* p = parser(R"(entry_point vertex as main = vtx_main)");
auto e = p->entry_point_decl();
ASSERT_NE(e, nullptr);
ASSERT_FALSE(p->has_error());
@@ -53,7 +53,7 @@
}
TEST_F(ParserImplTest, EntryPoint_MissingFnName) {
- auto p = parser(R"(entry_point vertex as main =)");
+ auto* p = parser(R"(entry_point vertex as main =)");
auto e = p->entry_point_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -61,7 +61,7 @@
}
TEST_F(ParserImplTest, EntryPoint_InvalidFnName) {
- auto p = parser(R"(entry_point vertex as main = 123)");
+ auto* p = parser(R"(entry_point vertex as main = 123)");
auto e = p->entry_point_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -69,7 +69,7 @@
}
TEST_F(ParserImplTest, EntryPoint_MissingEqual) {
- auto p = parser(R"(entry_point vertex as main vtx_main)");
+ auto* p = parser(R"(entry_point vertex as main vtx_main)");
auto e = p->entry_point_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -77,7 +77,7 @@
}
TEST_F(ParserImplTest, EntryPoint_MissingName) {
- auto p = parser(R"(entry_point vertex as = vtx_main)");
+ auto* p = parser(R"(entry_point vertex as = vtx_main)");
auto e = p->entry_point_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -85,7 +85,7 @@
}
TEST_F(ParserImplTest, EntryPoint_InvalidName) {
- auto p = parser(R"(entry_point vertex as 123 = vtx_main)");
+ auto* p = parser(R"(entry_point vertex as 123 = vtx_main)");
auto e = p->entry_point_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -93,7 +93,7 @@
}
TEST_F(ParserImplTest, EntryPoint_MissingStageWithIdent) {
- auto p = parser(R"(entry_point as 123 = vtx_main)");
+ auto* p = parser(R"(entry_point as 123 = vtx_main)");
auto e = p->entry_point_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -101,7 +101,7 @@
}
TEST_F(ParserImplTest, EntryPoint_MissingStage) {
- auto p = parser(R"(entry_point = vtx_main)");
+ auto* p = parser(R"(entry_point = vtx_main)");
auto e = p->entry_point_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -109,7 +109,7 @@
}
TEST_F(ParserImplTest, EntryPoint_InvalidStage) {
- auto p = parser(R"(entry_point invalid = vtx_main)");
+ auto* p = parser(R"(entry_point invalid = vtx_main)");
auto e = p->entry_point_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_equality_expression_test.cc b/src/reader/wgsl/parser_impl_equality_expression_test.cc
index 39a83b6..c427e6c 100644
--- a/src/reader/wgsl/parser_impl_equality_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_equality_expression_test.cc
@@ -26,58 +26,58 @@
namespace {
TEST_F(ParserImplTest, EqualityExpression_Parses_Equal) {
- auto p = parser("a == true");
+ auto* p = parser("a == true");
auto e = p->equality_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kEqual, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, EqualityExpression_Parses_NotEqual) {
- auto p = parser("a != true");
+ auto* p = parser("a != true");
auto e = p->equality_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kNotEqual, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, EqualityExpression_InvalidLHS) {
- auto p = parser("if (a) {} == true");
+ auto* p = parser("if (a) {} == true");
auto e = p->equality_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, nullptr);
}
TEST_F(ParserImplTest, EqualityExpression_InvalidRHS) {
- auto p = parser("true == if (a) {}");
+ auto* p = parser("true == if (a) {}");
auto e = p->equality_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -85,7 +85,7 @@
}
TEST_F(ParserImplTest, EqualityExpression_NoOr_ReturnsLHS) {
- auto p = parser("a true");
+ auto* p = parser("a true");
auto e = p->equality_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_exclusive_or_expression_test.cc b/src/reader/wgsl/parser_impl_exclusive_or_expression_test.cc
index bb4d21b..1e2d120 100644
--- a/src/reader/wgsl/parser_impl_exclusive_or_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_exclusive_or_expression_test.cc
@@ -26,36 +26,36 @@
namespace {
TEST_F(ParserImplTest, ExclusiveOrExpression_Parses) {
- auto p = parser("a ^ true");
+ auto* p = parser("a ^ true");
auto e = p->exclusive_or_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kXor, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, ExclusiveOrExpression_InvalidLHS) {
- auto p = parser("if (a) {} ^ true");
+ auto* p = parser("if (a) {} ^ true");
auto e = p->exclusive_or_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, nullptr);
}
TEST_F(ParserImplTest, ExclusiveOrExpression_InvalidRHS) {
- auto p = parser("true ^ if (a) {}");
+ auto* p = parser("true ^ if (a) {}");
auto e = p->exclusive_or_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -63,7 +63,7 @@
}
TEST_F(ParserImplTest, ExclusiveOrExpression_NoOr_ReturnsLHS) {
- auto p = parser("a true");
+ auto* p = parser("a true");
auto e = p->exclusive_or_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_function_decl_test.cc b/src/reader/wgsl/parser_impl_function_decl_test.cc
index be9b2e0..271634e 100644
--- a/src/reader/wgsl/parser_impl_function_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_function_decl_test.cc
@@ -24,7 +24,7 @@
namespace {
TEST_F(ParserImplTest, FunctionDecl) {
- auto p = parser("fn main(a : i32, b : f32) -> void { return; }");
+ auto* p = parser("fn main(a : i32, b : f32) -> void { return; }");
auto f = p->function_decl();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(f, nullptr);
@@ -33,19 +33,19 @@
ASSERT_NE(f->return_type(), nullptr);
EXPECT_TRUE(f->return_type()->IsVoid());
- ASSERT_EQ(f->params().size(), 2);
+ ASSERT_EQ(f->params().size(), 2u);
EXPECT_EQ(f->params()[0]->name(), "a");
EXPECT_EQ(f->params()[1]->name(), "b");
ASSERT_NE(f->return_type(), nullptr);
EXPECT_TRUE(f->return_type()->IsVoid());
- ASSERT_EQ(f->body().size(), 1);
+ ASSERT_EQ(f->body().size(), 1u);
EXPECT_TRUE(f->body()[0]->IsReturn());
}
TEST_F(ParserImplTest, FunctionDecl_InvalidHeader) {
- auto p = parser("fn main() -> { }");
+ auto* p = parser("fn main() -> { }");
auto f = p->function_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(f, nullptr);
@@ -53,7 +53,7 @@
}
TEST_F(ParserImplTest, FunctionDecl_InvalidBody) {
- auto p = parser("fn main() -> void { return }");
+ auto* p = parser("fn main() -> void { return }");
auto f = p->function_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(f, nullptr);
diff --git a/src/reader/wgsl/parser_impl_function_header_test.cc b/src/reader/wgsl/parser_impl_function_header_test.cc
index 94b9886..2b482f8 100644
--- a/src/reader/wgsl/parser_impl_function_header_test.cc
+++ b/src/reader/wgsl/parser_impl_function_header_test.cc
@@ -24,20 +24,20 @@
namespace {
TEST_F(ParserImplTest, FunctionHeader) {
- auto p = parser("fn main(a : i32, b: f32) -> void");
+ auto* p = parser("fn main(a : i32, b: f32) -> void");
auto f = p->function_header();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(f, nullptr);
EXPECT_EQ(f->name(), "main");
- ASSERT_EQ(f->params().size(), 2);
+ ASSERT_EQ(f->params().size(), 2u);
EXPECT_EQ(f->params()[0]->name(), "a");
EXPECT_EQ(f->params()[1]->name(), "b");
EXPECT_TRUE(f->return_type()->IsVoid());
}
TEST_F(ParserImplTest, FunctionHeader_MissingIdent) {
- auto p = parser("fn () ->");
+ auto* p = parser("fn () ->");
auto f = p->function_header();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(f, nullptr);
@@ -45,7 +45,7 @@
}
TEST_F(ParserImplTest, FunctionHeader_InvalidIdent) {
- auto p = parser("fn 133main() -> i32");
+ auto* p = parser("fn 133main() -> i32");
auto f = p->function_header();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(f, nullptr);
@@ -53,7 +53,7 @@
}
TEST_F(ParserImplTest, FunctionHeader_MissingParenLeft) {
- auto p = parser("fn main) -> i32");
+ auto* p = parser("fn main) -> i32");
auto f = p->function_header();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(f, nullptr);
@@ -61,7 +61,7 @@
}
TEST_F(ParserImplTest, FunctionHeader_InvalidParamList) {
- auto p = parser("fn main(a :i32,) -> i32");
+ auto* p = parser("fn main(a :i32,) -> i32");
auto f = p->function_header();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(f, nullptr);
@@ -69,7 +69,7 @@
}
TEST_F(ParserImplTest, FunctionHeader_MissingParenRight) {
- auto p = parser("fn main( -> i32");
+ auto* p = parser("fn main( -> i32");
auto f = p->function_header();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(f, nullptr);
@@ -77,7 +77,7 @@
}
TEST_F(ParserImplTest, FunctionHeader_MissingArrow) {
- auto p = parser("fn main() i32");
+ auto* p = parser("fn main() i32");
auto f = p->function_header();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(f, nullptr);
@@ -85,7 +85,7 @@
}
TEST_F(ParserImplTest, FunctionHeader_InvalidReturnType) {
- auto p = parser("fn main() -> invalid");
+ auto* p = parser("fn main() -> invalid");
auto f = p->function_header();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(f, nullptr);
@@ -93,7 +93,7 @@
}
TEST_F(ParserImplTest, FunctionHeader_MissingReturnType) {
- auto p = parser("fn main() ->");
+ auto* p = parser("fn main() ->");
auto f = p->function_header();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(f, nullptr);
diff --git a/src/reader/wgsl/parser_impl_function_type_decl_test.cc b/src/reader/wgsl/parser_impl_function_type_decl_test.cc
index 7a9e737..c5e4e16 100644
--- a/src/reader/wgsl/parser_impl_function_type_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_function_type_decl_test.cc
@@ -28,27 +28,27 @@
namespace {
TEST_F(ParserImplTest, FunctionTypeDecl_Void) {
- auto v = tm()->Get(std::make_unique<ast::type::VoidType>());
+ auto* v = tm()->Get(std::make_unique<ast::type::VoidType>());
- auto p = parser("void");
- auto e = p->function_type_decl();
+ auto* p = parser("void");
+ auto* e = p->function_type_decl();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, v);
}
TEST_F(ParserImplTest, FunctionTypeDecl_Type) {
- auto f32 = tm()->Get(std::make_unique<ast::type::F32Type>());
- auto vec2 = tm()->Get(std::make_unique<ast::type::VectorType>(f32, 2));
+ auto* f32 = tm()->Get(std::make_unique<ast::type::F32Type>());
+ auto* vec2 = tm()->Get(std::make_unique<ast::type::VectorType>(f32, 2));
- auto p = parser("vec2<f32>");
- auto e = p->function_type_decl();
+ auto* p = parser("vec2<f32>");
+ auto* e = p->function_type_decl();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, vec2);
}
TEST_F(ParserImplTest, FunctionTypeDecl_InvalidType) {
- auto p = parser("vec2<invalid>");
- auto e = p->function_type_decl();
+ auto* p = parser("vec2<invalid>");
+ auto* e = p->function_type_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
EXPECT_EQ(p->error(), "1:6: unknown type alias 'invalid'");
diff --git a/src/reader/wgsl/parser_impl_global_constant_decl_test.cc b/src/reader/wgsl/parser_impl_global_constant_decl_test.cc
index 3f53a04..c9abe0a 100644
--- a/src/reader/wgsl/parser_impl_global_constant_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_global_constant_decl_test.cc
@@ -24,7 +24,7 @@
namespace {
TEST_F(ParserImplTest, GlobalConstantDecl) {
- auto p = parser("const a : f32 = 1.");
+ auto* p = parser("const a : f32 = 1.");
auto e = p->global_constant_decl();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -39,7 +39,7 @@
}
TEST_F(ParserImplTest, GlobalConstantDecl_MissingEqual) {
- auto p = parser("const a: f32 1.");
+ auto* p = parser("const a: f32 1.");
auto e = p->global_constant_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -47,7 +47,7 @@
}
TEST_F(ParserImplTest, GlobalConstantDecl_InvalidVariable) {
- auto p = parser("const a: invalid = 1.");
+ auto* p = parser("const a: invalid = 1.");
auto e = p->global_constant_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -55,7 +55,7 @@
}
TEST_F(ParserImplTest, GlobalConstantDecl_InvalidExpression) {
- auto p = parser("const a: f32 = if (a) {}");
+ auto* p = parser("const a: f32 = if (a) {}");
auto e = p->global_constant_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -63,7 +63,7 @@
}
TEST_F(ParserImplTest, GlobalConstantDecl_MissingExpression) {
- auto p = parser("const a: f32 =");
+ auto* p = parser("const a: f32 =");
auto e = p->global_constant_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_global_decl_test.cc b/src/reader/wgsl/parser_impl_global_decl_test.cc
index 188a658..489f07d 100644
--- a/src/reader/wgsl/parser_impl_global_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_global_decl_test.cc
@@ -22,18 +22,18 @@
namespace {
TEST_F(ParserImplTest, GlobalDecl_Semicolon) {
- auto p = parser(";");
+ auto* p = parser(";");
p->global_decl();
ASSERT_FALSE(p->has_error()) << p->error();
}
TEST_F(ParserImplTest, GlobalDecl_Import) {
- auto p = parser(R"(import "GLSL.std.430" as glsl;)");
+ auto* p = parser(R"(import "GLSL.std.430" as glsl;)");
p->global_decl();
ASSERT_FALSE(p->has_error()) << p->error();
auto m = p->module();
- ASSERT_EQ(1, m.imports().size());
+ ASSERT_EQ(1u, m.imports().size());
const auto& import = m.imports()[0];
EXPECT_EQ("GLSL.std.430", import->path());
@@ -41,7 +41,7 @@
}
TEST_F(ParserImplTest, GlobalDecl_Import_Invalid) {
- auto p = parser(R"(import as glsl;)");
+ auto* p = parser(R"(import as glsl;)");
p->global_decl();
ASSERT_TRUE(p->has_error());
@@ -49,7 +49,7 @@
}
TEST_F(ParserImplTest, GlobalDecl_Import_Invalid_MissingSemicolon) {
- auto p = parser(R"(import "GLSL.std.430" as glsl)");
+ auto* p = parser(R"(import "GLSL.std.430" as glsl)");
p->global_decl();
ASSERT_TRUE(p->has_error());
@@ -57,117 +57,117 @@
}
TEST_F(ParserImplTest, GlobalDecl_GlobalVariable) {
- auto p = parser("var<out> a : vec2<i32> = vec2<i32>(1, 2);");
+ auto* p = parser("var<out> a : vec2<i32> = vec2<i32>(1, 2);");
p->global_decl();
ASSERT_FALSE(p->has_error()) << p->error();
auto m = p->module();
- ASSERT_EQ(m.global_variables().size(), 1);
+ ASSERT_EQ(m.global_variables().size(), 1u);
- auto v = m.global_variables()[0].get();
+ auto* v = m.global_variables()[0].get();
EXPECT_EQ(v->name(), "a");
}
TEST_F(ParserImplTest, GlobalDecl_GlobalVariable_Invalid) {
- auto p = parser("var<out> a : vec2<invalid>;");
+ auto* p = parser("var<out> a : vec2<invalid>;");
p->global_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:19: unknown type alias 'invalid'");
}
TEST_F(ParserImplTest, GlobalDecl_GlobalVariable_MissingSemicolon) {
- auto p = parser("var<out> a : vec2<i32>");
+ auto* p = parser("var<out> a : vec2<i32>");
p->global_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:23: missing ';' for variable declaration");
}
TEST_F(ParserImplTest, GlobalDecl_GlobalConstant) {
- auto p = parser("const a : i32 = 2;");
+ auto* p = parser("const a : i32 = 2;");
p->global_decl();
ASSERT_FALSE(p->has_error()) << p->error();
auto m = p->module();
- ASSERT_EQ(m.global_variables().size(), 1);
+ ASSERT_EQ(m.global_variables().size(), 1u);
- auto v = m.global_variables()[0].get();
+ auto* v = m.global_variables()[0].get();
EXPECT_EQ(v->name(), "a");
}
TEST_F(ParserImplTest, GlobalDecl_GlobalConstant_Invalid) {
- auto p = parser("const a : vec2<i32>;");
+ auto* p = parser("const a : vec2<i32>;");
p->global_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:20: missing = for const declaration");
}
TEST_F(ParserImplTest, GlobalDecl_GlobalConstant_MissingSemicolon) {
- auto p = parser("const a : vec2<i32> = vec2<i32>(1, 2)");
+ auto* p = parser("const a : vec2<i32> = vec2<i32>(1, 2)");
p->global_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:38: missing ';' for constant declaration");
}
TEST_F(ParserImplTest, GlobalDecl_EntryPoint) {
- auto p = parser("entry_point vertex = main;");
+ auto* p = parser("entry_point vertex = main;");
p->global_decl();
ASSERT_FALSE(p->has_error()) << p->error();
auto m = p->module();
- ASSERT_EQ(m.entry_points().size(), 1);
+ ASSERT_EQ(m.entry_points().size(), 1u);
EXPECT_EQ(m.entry_points()[0]->name(), "main");
}
TEST_F(ParserImplTest, GlobalDecl_EntryPoint_Invalid) {
- auto p = parser("entry_point main;");
+ auto* p = parser("entry_point main;");
p->global_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:13: missing pipeline stage for entry point");
}
TEST_F(ParserImplTest, GlobalDecl_EntryPoint_MissingSemicolon) {
- auto p = parser("entry_point vertex = main");
+ auto* p = parser("entry_point vertex = main");
p->global_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:26: missing ';' for entry point");
}
TEST_F(ParserImplTest, GlobalDecl_TypeAlias) {
- auto p = parser("type A = i32;");
+ auto* p = parser("type A = i32;");
p->global_decl();
ASSERT_FALSE(p->has_error()) << p->error();
auto m = p->module();
- ASSERT_EQ(m.alias_types().size(), 1);
+ ASSERT_EQ(m.alias_types().size(), 1u);
EXPECT_EQ(m.alias_types()[0]->name(), "A");
}
TEST_F(ParserImplTest, GlobalDecl_TypeAlias_Invalid) {
- auto p = parser("type A = invalid;");
+ auto* p = parser("type A = invalid;");
p->global_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:10: unknown type alias 'invalid'");
}
TEST_F(ParserImplTest, GlobalDecl_TypeAlias_MissingSemicolon) {
- auto p = parser("type A = i32");
+ auto* p = parser("type A = i32");
p->global_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:13: missing ';' for type alias");
}
TEST_F(ParserImplTest, GlobalDecl_Function) {
- auto p = parser("fn main() -> void { return; }");
+ auto* p = parser("fn main() -> void { return; }");
p->global_decl();
ASSERT_FALSE(p->has_error()) << p->error();
auto m = p->module();
- ASSERT_EQ(m.functions().size(), 1);
+ ASSERT_EQ(m.functions().size(), 1u);
EXPECT_EQ(m.functions()[0]->name(), "main");
}
TEST_F(ParserImplTest, GlobalDecl_Function_Invalid) {
- auto p = parser("fn main() -> { return; }");
+ auto* p = parser("fn main() -> { return; }");
p->global_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:14: unable to determine function return type");
diff --git a/src/reader/wgsl/parser_impl_global_variable_decl_test.cc b/src/reader/wgsl/parser_impl_global_variable_decl_test.cc
index d7ff3c6..fa1aad6 100644
--- a/src/reader/wgsl/parser_impl_global_variable_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_global_variable_decl_test.cc
@@ -24,7 +24,7 @@
namespace {
TEST_F(ParserImplTest, GlobalVariableDecl_WithoutConstructor) {
- auto p = parser("var<out> a : f32");
+ auto* p = parser("var<out> a : f32");
auto e = p->global_variable_decl();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -38,7 +38,7 @@
}
TEST_F(ParserImplTest, GlobalVariableDecl_WithConstructor) {
- auto p = parser("var<out> a : f32 = 1.");
+ auto* p = parser("var<out> a : f32 = 1.");
auto e = p->global_variable_decl();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -55,7 +55,7 @@
}
TEST_F(ParserImplTest, GlobalVariableDecl_WithDecoration) {
- auto p = parser("[[binding 2, set 1]] var<out> a : f32");
+ auto* p = parser("[[binding 2, set 1]] var<out> a : f32");
auto e = p->global_variable_decl();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -69,16 +69,16 @@
ASSERT_EQ(e->constructor(), nullptr);
ASSERT_TRUE(e->IsDecorated());
- auto v = e->AsDecorated();
+ auto* v = e->AsDecorated();
auto& decos = v->decorations();
- ASSERT_EQ(decos.size(), 2);
+ ASSERT_EQ(decos.size(), 2u);
ASSERT_TRUE(decos[0]->IsBinding());
ASSERT_TRUE(decos[1]->IsSet());
}
TEST_F(ParserImplTest, GlobalVariableDecl_InvalidDecoration) {
- auto p = parser("[[binding]] var<out> a : f32");
+ auto* p = parser("[[binding]] var<out> a : f32");
auto e = p->global_variable_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -86,7 +86,7 @@
}
TEST_F(ParserImplTest, GlobalVariableDecl_InvalidConstExpr) {
- auto p = parser("var<out> a : f32 = if (a) {}");
+ auto* p = parser("var<out> a : f32 = if (a) {}");
auto e = p->global_variable_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -94,7 +94,7 @@
}
TEST_F(ParserImplTest, GlobalVariableDecl_InvalidVariableDecl) {
- auto p = parser("var<invalid> a : f32;");
+ auto* p = parser("var<invalid> a : f32;");
auto e = p->global_variable_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_if_stmt_test.cc b/src/reader/wgsl/parser_impl_if_stmt_test.cc
index 56bd415..71173ad 100644
--- a/src/reader/wgsl/parser_impl_if_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_if_stmt_test.cc
@@ -24,7 +24,7 @@
namespace {
TEST_F(ParserImplTest, IfStmt) {
- auto p = parser("if (a == 4) { a = b; c = d; }");
+ auto* p = parser("if (a == 4) { a = b; c = d; }");
auto e = p->if_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -32,12 +32,13 @@
ASSERT_TRUE(e->IsIf());
ASSERT_NE(e->condition(), nullptr);
ASSERT_TRUE(e->condition()->IsBinary());
- EXPECT_EQ(e->body().size(), 2);
- EXPECT_EQ(e->else_statements().size(), 0);
+ EXPECT_EQ(e->body().size(), 2u);
+ EXPECT_EQ(e->else_statements().size(), 0u);
}
TEST_F(ParserImplTest, IfStmt_WithElse) {
- auto p = parser("if (a == 4) { a = b; c = d; } elseif(c) { d = 2; } else {}");
+ auto* p =
+ parser("if (a == 4) { a = b; c = d; } elseif(c) { d = 2; } else {}");
auto e = p->if_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -45,19 +46,19 @@
ASSERT_TRUE(e->IsIf());
ASSERT_NE(e->condition(), nullptr);
ASSERT_TRUE(e->condition()->IsBinary());
- EXPECT_EQ(e->body().size(), 2);
+ EXPECT_EQ(e->body().size(), 2u);
- ASSERT_EQ(e->else_statements().size(), 2);
+ ASSERT_EQ(e->else_statements().size(), 2u);
ASSERT_NE(e->else_statements()[0]->condition(), nullptr);
ASSERT_TRUE(e->else_statements()[0]->condition()->IsIdentifier());
- EXPECT_EQ(e->else_statements()[0]->body().size(), 1);
+ EXPECT_EQ(e->else_statements()[0]->body().size(), 1u);
ASSERT_EQ(e->else_statements()[1]->condition(), nullptr);
- EXPECT_EQ(e->else_statements()[1]->body().size(), 0);
+ EXPECT_EQ(e->else_statements()[1]->body().size(), 0u);
}
TEST_F(ParserImplTest, IfStmt_InvalidCondition) {
- auto p = parser("if (a = 3) {}");
+ auto* p = parser("if (a = 3) {}");
auto e = p->if_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -65,7 +66,7 @@
}
TEST_F(ParserImplTest, IfStmt_MissingCondition) {
- auto p = parser("if {}");
+ auto* p = parser("if {}");
auto e = p->if_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -73,7 +74,7 @@
}
TEST_F(ParserImplTest, IfStmt_InvalidBody) {
- auto p = parser("if (a) { fn main() -> void {}}");
+ auto* p = parser("if (a) { fn main() -> void {}}");
auto e = p->if_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -81,7 +82,7 @@
}
TEST_F(ParserImplTest, IfStmt_MissingBody) {
- auto p = parser("if (a)");
+ auto* p = parser("if (a)");
auto e = p->if_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -89,7 +90,7 @@
}
TEST_F(ParserImplTest, IfStmt_InvalidElseif) {
- auto p = parser("if (a) {} elseif (a) { fn main() -> a{}}");
+ auto* p = parser("if (a) {} elseif (a) { fn main() -> a{}}");
auto e = p->if_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -97,7 +98,7 @@
}
TEST_F(ParserImplTest, IfStmt_InvalidElse) {
- auto p = parser("if (a) {} else { fn main() -> a{}}");
+ auto* p = parser("if (a) {} else { fn main() -> a{}}");
auto e = p->if_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_import_decl_test.cc b/src/reader/wgsl/parser_impl_import_decl_test.cc
index 5fc4f04..abf4582 100644
--- a/src/reader/wgsl/parser_impl_import_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_import_decl_test.cc
@@ -22,7 +22,7 @@
namespace {
TEST_F(ParserImplTest, ImportDecl_Import) {
- auto p = parser(R"(import "GLSL.std.450" as glsl)");
+ auto* p = parser(R"(import "GLSL.std.450" as glsl)");
auto import = p->import_decl();
ASSERT_NE(import, nullptr);
@@ -30,12 +30,12 @@
EXPECT_EQ("GLSL.std.450", import->path());
EXPECT_EQ("glsl", import->name());
- EXPECT_EQ(1, import->line());
- EXPECT_EQ(1, import->column());
+ EXPECT_EQ(1u, import->line());
+ EXPECT_EQ(1u, import->column());
}
TEST_F(ParserImplTest, ImportDecl_Import_WithNamespace) {
- auto p = parser(R"(import "GLSL.std.450" as std::glsl)");
+ auto* p = parser(R"(import "GLSL.std.450" as std::glsl)");
auto import = p->import_decl();
ASSERT_NE(import, nullptr);
ASSERT_FALSE(p->has_error()) << p->error();
@@ -43,7 +43,7 @@
}
TEST_F(ParserImplTest, ImportDecl_Invalid_MissingPath) {
- auto p = parser(R"(import as glsl)");
+ auto* p = parser(R"(import as glsl)");
auto import = p->import_decl();
ASSERT_EQ(import, nullptr);
ASSERT_TRUE(p->has_error());
@@ -51,7 +51,7 @@
}
TEST_F(ParserImplTest, ImportDecl_Invalid_EmptyPath) {
- auto p = parser(R"(import "" as glsl)");
+ auto* p = parser(R"(import "" as glsl)");
auto import = p->import_decl();
ASSERT_EQ(import, nullptr);
ASSERT_TRUE(p->has_error());
@@ -59,7 +59,7 @@
}
TEST_F(ParserImplTest, ImportDecl_Invalid_NameMissingTerminatingIdentifier) {
- auto p = parser(R"(import "GLSL.std.450" as glsl::)");
+ auto* p = parser(R"(import "GLSL.std.450" as glsl::)");
auto import = p->import_decl();
ASSERT_EQ(import, nullptr);
ASSERT_TRUE(p->has_error());
@@ -67,7 +67,7 @@
}
TEST_F(ParserImplTest, ImportDecl_Invalid_NameInvalid) {
- auto p = parser(R"(import "GLSL.std.450" as 12glsl)");
+ auto* p = parser(R"(import "GLSL.std.450" as 12glsl)");
auto import = p->import_decl();
ASSERT_EQ(import, nullptr);
ASSERT_TRUE(p->has_error());
@@ -75,7 +75,7 @@
}
TEST_F(ParserImplTest, ImportDecl_Invalid_MissingName) {
- auto p = parser(R"(import "GLSL.std.450" as)");
+ auto* p = parser(R"(import "GLSL.std.450" as)");
auto import = p->import_decl();
ASSERT_EQ(import, nullptr);
ASSERT_TRUE(p->has_error());
@@ -83,7 +83,7 @@
}
TEST_F(ParserImplTest, ImportDecl_Invalid_MissingAs) {
- auto p = parser(R"(import "GLSL.std.450" glsl)");
+ auto* p = parser(R"(import "GLSL.std.450" glsl)");
auto import = p->import_decl();
ASSERT_EQ(import, nullptr);
ASSERT_TRUE(p->has_error());
diff --git a/src/reader/wgsl/parser_impl_inclusive_or_expression_test.cc b/src/reader/wgsl/parser_impl_inclusive_or_expression_test.cc
index bbbe778..3311e74 100644
--- a/src/reader/wgsl/parser_impl_inclusive_or_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_inclusive_or_expression_test.cc
@@ -26,36 +26,36 @@
namespace {
TEST_F(ParserImplTest, InclusiveOrExpression_Parses) {
- auto p = parser("a | true");
+ auto* p = parser("a | true");
auto e = p->inclusive_or_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kOr, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, InclusiveOrExpression_InvalidLHS) {
- auto p = parser("if (a) {} | true");
+ auto* p = parser("if (a) {} | true");
auto e = p->inclusive_or_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, nullptr);
}
TEST_F(ParserImplTest, InclusiveOrExpression_InvalidRHS) {
- auto p = parser("true | if (a) {}");
+ auto* p = parser("true | if (a) {}");
auto e = p->inclusive_or_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -63,7 +63,7 @@
}
TEST_F(ParserImplTest, InclusiveOrExpression_NoOr_ReturnsLHS) {
- auto p = parser("a true");
+ auto* p = parser("a true");
auto e = p->inclusive_or_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_logical_and_expression_test.cc b/src/reader/wgsl/parser_impl_logical_and_expression_test.cc
index 9c7029e..6434e0a 100644
--- a/src/reader/wgsl/parser_impl_logical_and_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_logical_and_expression_test.cc
@@ -26,36 +26,36 @@
namespace {
TEST_F(ParserImplTest, LogicalAndExpression_Parses) {
- auto p = parser("a && true");
+ auto* p = parser("a && true");
auto e = p->logical_and_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kLogicalAnd, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, LogicalAndExpression_InvalidLHS) {
- auto p = parser("if (a) {} && true");
+ auto* p = parser("if (a) {} && true");
auto e = p->logical_and_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, nullptr);
}
TEST_F(ParserImplTest, LogicalAndExpression_InvalidRHS) {
- auto p = parser("true && if (a) {}");
+ auto* p = parser("true && if (a) {}");
auto e = p->logical_and_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -63,7 +63,7 @@
}
TEST_F(ParserImplTest, LogicalAndExpression_NoOr_ReturnsLHS) {
- auto p = parser("a true");
+ auto* p = parser("a true");
auto e = p->logical_and_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_logical_or_expression_test.cc b/src/reader/wgsl/parser_impl_logical_or_expression_test.cc
index bc19f61..63e1c64 100644
--- a/src/reader/wgsl/parser_impl_logical_or_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_logical_or_expression_test.cc
@@ -26,36 +26,36 @@
namespace {
TEST_F(ParserImplTest, LogicalOrExpression_Parses) {
- auto p = parser("a || true");
+ auto* p = parser("a || true");
auto e = p->logical_or_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kLogicalOr, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, LogicalOrExpression_InvalidLHS) {
- auto p = parser("if (a) {} || true");
+ auto* p = parser("if (a) {} || true");
auto e = p->logical_or_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, nullptr);
}
TEST_F(ParserImplTest, LogicalOrExpression_InvalidRHS) {
- auto p = parser("true || if (a) {}");
+ auto* p = parser("true || if (a) {}");
auto e = p->logical_or_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -63,7 +63,7 @@
}
TEST_F(ParserImplTest, LogicalOrExpression_NoOr_ReturnsLHS) {
- auto p = parser("a true");
+ auto* p = parser("a true");
auto e = p->logical_or_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_loop_stmt_test.cc b/src/reader/wgsl/parser_impl_loop_stmt_test.cc
index 434ace5..ea7a245 100644
--- a/src/reader/wgsl/parser_impl_loop_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_loop_stmt_test.cc
@@ -22,51 +22,51 @@
namespace {
TEST_F(ParserImplTest, LoopStmt_BodyNoContinuing) {
- auto p = parser("loop { nop; }");
+ auto* p = parser("loop { nop; }");
auto e = p->loop_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
- ASSERT_EQ(e->body().size(), 1);
+ ASSERT_EQ(e->body().size(), 1u);
EXPECT_TRUE(e->body()[0]->IsNop());
- EXPECT_EQ(e->continuing().size(), 0);
+ EXPECT_EQ(e->continuing().size(), 0u);
}
TEST_F(ParserImplTest, LoopStmt_BodyWithContinuing) {
- auto p = parser("loop { nop; continuing { kill; }}");
+ auto* p = parser("loop { nop; continuing { kill; }}");
auto e = p->loop_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
- ASSERT_EQ(e->body().size(), 1);
+ ASSERT_EQ(e->body().size(), 1u);
EXPECT_TRUE(e->body()[0]->IsNop());
- EXPECT_EQ(e->continuing().size(), 1);
+ EXPECT_EQ(e->continuing().size(), 1u);
EXPECT_TRUE(e->continuing()[0]->IsKill());
}
TEST_F(ParserImplTest, LoopStmt_NoBodyNoContinuing) {
- auto p = parser("loop { }");
+ auto* p = parser("loop { }");
auto e = p->loop_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
- ASSERT_EQ(e->body().size(), 0);
- ASSERT_EQ(e->continuing().size(), 0);
+ ASSERT_EQ(e->body().size(), 0u);
+ ASSERT_EQ(e->continuing().size(), 0u);
}
TEST_F(ParserImplTest, LoopStmt_NoBodyWithContinuing) {
- auto p = parser("loop { continuing { kill; }}");
+ auto* p = parser("loop { continuing { kill; }}");
auto e = p->loop_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
- ASSERT_EQ(e->body().size(), 0);
- ASSERT_EQ(e->continuing().size(), 1);
+ ASSERT_EQ(e->body().size(), 0u);
+ ASSERT_EQ(e->continuing().size(), 1u);
EXPECT_TRUE(e->continuing()[0]->IsKill());
}
TEST_F(ParserImplTest, LoopStmt_MissingBracketLeft) {
- auto p = parser("loop kill; }");
+ auto* p = parser("loop kill; }");
auto e = p->loop_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -74,7 +74,7 @@
}
TEST_F(ParserImplTest, LoopStmt_MissingBracketRight) {
- auto p = parser("loop { kill; ");
+ auto* p = parser("loop { kill; ");
auto e = p->loop_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -82,7 +82,7 @@
}
TEST_F(ParserImplTest, LoopStmt_InvalidStatements) {
- auto p = parser("loop { kill }");
+ auto* p = parser("loop { kill }");
auto e = p->loop_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -90,7 +90,7 @@
}
TEST_F(ParserImplTest, LoopStmt_InvalidContinuing) {
- auto p = parser("loop { continuing { kill }}");
+ auto* p = parser("loop { continuing { kill }}");
auto e = p->loop_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_multiplicative_expression_test.cc b/src/reader/wgsl/parser_impl_multiplicative_expression_test.cc
index cba8fc1..22a9dfc 100644
--- a/src/reader/wgsl/parser_impl_multiplicative_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_multiplicative_expression_test.cc
@@ -26,80 +26,80 @@
namespace {
TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Multiply) {
- auto p = parser("a * true");
+ auto* p = parser("a * true");
auto e = p->multiplicative_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kMultiply, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Divide) {
- auto p = parser("a / true");
+ auto* p = parser("a / true");
auto e = p->multiplicative_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kDivide, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Modulo) {
- auto p = parser("a % true");
+ auto* p = parser("a % true");
auto e = p->multiplicative_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kModulo, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, MultiplicativeExpression_InvalidLHS) {
- auto p = parser("if (a) {} * true");
+ auto* p = parser("if (a) {} * true");
auto e = p->multiplicative_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, nullptr);
}
TEST_F(ParserImplTest, MultiplicativeExpression_InvalidRHS) {
- auto p = parser("true * if (a) {}");
+ auto* p = parser("true * if (a) {}");
auto e = p->multiplicative_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -107,7 +107,7 @@
}
TEST_F(ParserImplTest, MultiplicativeExpression_NoOr_ReturnsLHS) {
- auto p = parser("a true");
+ auto* p = parser("a true");
auto e = p->multiplicative_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_param_list_test.cc b/src/reader/wgsl/parser_impl_param_list_test.cc
index f337f65..ca8c38e 100644
--- a/src/reader/wgsl/parser_impl_param_list_test.cc
+++ b/src/reader/wgsl/parser_impl_param_list_test.cc
@@ -29,26 +29,26 @@
namespace {
TEST_F(ParserImplTest, ParamList_Single) {
- auto i32 = tm()->Get(std::make_unique<ast::type::I32Type>());
+ auto* i32 = tm()->Get(std::make_unique<ast::type::I32Type>());
- auto p = parser("a : i32");
+ auto* p = parser("a : i32");
auto e = p->param_list();
ASSERT_FALSE(p->has_error()) << p->error();
- EXPECT_EQ(e.size(), 1);
+ EXPECT_EQ(e.size(), 1u);
EXPECT_EQ(e[0]->name(), "a");
EXPECT_EQ(e[0]->type(), i32);
}
TEST_F(ParserImplTest, ParamList_Multiple) {
- auto i32 = tm()->Get(std::make_unique<ast::type::I32Type>());
- auto f32 = tm()->Get(std::make_unique<ast::type::F32Type>());
- auto vec2 = tm()->Get(std::make_unique<ast::type::VectorType>(f32, 2));
+ auto* i32 = tm()->Get(std::make_unique<ast::type::I32Type>());
+ auto* f32 = tm()->Get(std::make_unique<ast::type::F32Type>());
+ auto* vec2 = tm()->Get(std::make_unique<ast::type::VectorType>(f32, 2));
- auto p = parser("a : i32, b: f32, c: vec2<f32>");
+ auto* p = parser("a : i32, b: f32, c: vec2<f32>");
auto e = p->param_list();
ASSERT_FALSE(p->has_error()) << p->error();
- EXPECT_EQ(e.size(), 3);
+ EXPECT_EQ(e.size(), 3u);
EXPECT_EQ(e[0]->name(), "a");
EXPECT_EQ(e[0]->type(), i32);
@@ -61,14 +61,14 @@
}
TEST_F(ParserImplTest, ParamList_Empty) {
- auto p = parser("");
+ auto* p = parser("");
auto e = p->param_list();
ASSERT_FALSE(p->has_error()) << p->error();
- EXPECT_EQ(e.size(), 0);
+ EXPECT_EQ(e.size(), 0u);
}
TEST_F(ParserImplTest, ParamList_HangingComma) {
- auto p = parser("a : i32,");
+ auto* p = parser("a : i32,");
auto e = p->param_list();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:8: found , but no variable declaration");
diff --git a/src/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc b/src/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc
index fde1394..0610446 100644
--- a/src/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc
@@ -22,7 +22,7 @@
namespace {
TEST_F(ParserImplTest, ParenRhsStmt) {
- auto p = parser("(a + b)");
+ auto* p = parser("(a + b)");
auto e = p->paren_rhs_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -30,7 +30,7 @@
}
TEST_F(ParserImplTest, ParenRhsStmt_MissingLeftParen) {
- auto p = parser("true)");
+ auto* p = parser("true)");
auto e = p->paren_rhs_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -38,7 +38,7 @@
}
TEST_F(ParserImplTest, ParenRhsStmt_MissingRightParen) {
- auto p = parser("(true");
+ auto* p = parser("(true");
auto e = p->paren_rhs_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -46,7 +46,7 @@
}
TEST_F(ParserImplTest, ParenRhsStmt_InvalidExpression) {
- auto p = parser("(if (a() {})");
+ auto* p = parser("(if (a() {})");
auto e = p->paren_rhs_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -54,7 +54,7 @@
}
TEST_F(ParserImplTest, ParenRhsStmt_MissingExpression) {
- auto p = parser("()");
+ auto* p = parser("()");
auto e = p->paren_rhs_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_pipeline_stage_test.cc b/src/reader/wgsl/parser_impl_pipeline_stage_test.cc
index b566534..19bac5c 100644
--- a/src/reader/wgsl/parser_impl_pipeline_stage_test.cc
+++ b/src/reader/wgsl/parser_impl_pipeline_stage_test.cc
@@ -36,9 +36,9 @@
PipelineStageTest() = default;
~PipelineStageTest() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -52,7 +52,7 @@
TEST_P(PipelineStageTest, Parses) {
auto params = GetParam();
- auto p = parser(params.input);
+ auto* p = parser(params.input);
auto stage = p->pipeline_stage();
ASSERT_FALSE(p->has_error());
@@ -70,7 +70,7 @@
PipelineStageData{"compute", ast::PipelineStage::kCompute}));
TEST_F(ParserImplTest, PipelineStage_NoMatch) {
- auto p = parser("not-a-stage");
+ auto* p = parser("not-a-stage");
auto stage = p->pipeline_stage();
ASSERT_EQ(stage, ast::PipelineStage::kNone);
diff --git a/src/reader/wgsl/parser_impl_postfix_expression_test.cc b/src/reader/wgsl/parser_impl_postfix_expression_test.cc
index 66380cb..5b7be35 100644
--- a/src/reader/wgsl/parser_impl_postfix_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_postfix_expression_test.cc
@@ -31,45 +31,45 @@
namespace {
TEST_F(ParserImplTest, PostfixExpression_Array_ConstantIndex) {
- auto p = parser("a[1]");
+ auto* p = parser("a[1]");
auto e = p->postfix_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsArrayAccessor());
- auto ary = e->AsArrayAccessor();
+ auto* ary = e->AsArrayAccessor();
ASSERT_TRUE(ary->array()->IsIdentifier());
- auto ident = ary->array()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = ary->array()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(ary->idx_expr()->IsConstructor());
ASSERT_TRUE(ary->idx_expr()->AsConstructor()->IsScalarConstructor());
- auto c = ary->idx_expr()->AsConstructor()->AsScalarConstructor();
+ auto* c = ary->idx_expr()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(c->literal()->IsInt());
EXPECT_EQ(c->literal()->AsInt()->value(), 1);
}
TEST_F(ParserImplTest, PostfixExpression_Array_ExpressionIndex) {
- auto p = parser("a[1 + b / 4]");
+ auto* p = parser("a[1 + b / 4]");
auto e = p->postfix_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsArrayAccessor());
- auto ary = e->AsArrayAccessor();
+ auto* ary = e->AsArrayAccessor();
ASSERT_TRUE(ary->array()->IsIdentifier());
- auto ident = ary->array()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = ary->array()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(ary->idx_expr()->IsBinary());
}
TEST_F(ParserImplTest, PostfixExpression_Array_MissingIndex) {
- auto p = parser("a[]");
+ auto* p = parser("a[]");
auto e = p->postfix_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -77,7 +77,7 @@
}
TEST_F(ParserImplTest, PostfixExpression_Array_MissingRightBrace) {
- auto p = parser("a[1");
+ auto* p = parser("a[1");
auto e = p->postfix_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -85,7 +85,7 @@
}
TEST_F(ParserImplTest, PostfixExpression_Array_InvalidIndex) {
- auto p = parser("a[if(a() {})]");
+ auto* p = parser("a[if(a() {})]");
auto e = p->postfix_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -93,45 +93,45 @@
}
TEST_F(ParserImplTest, PostfixExpression_Call_Empty) {
- auto p = parser("a()");
+ auto* p = parser("a()");
auto e = p->postfix_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsCall());
- auto c = e->AsCall();
+ auto* c = e->AsCall();
ASSERT_TRUE(c->func()->IsIdentifier());
- auto func = c->func()->AsIdentifier();
- ASSERT_EQ(func->name().size(), 1);
+ auto* func = c->func()->AsIdentifier();
+ ASSERT_EQ(func->name().size(), 1u);
EXPECT_EQ(func->name()[0], "a");
- EXPECT_EQ(c->params().size(), 0);
+ EXPECT_EQ(c->params().size(), 0u);
}
TEST_F(ParserImplTest, PostfixExpression_Call_WithArgs) {
- auto p = parser("std::test(1, b, 2 + 3 / b)");
+ auto* p = parser("std::test(1, b, 2 + 3 / b)");
auto e = p->postfix_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsCall());
- auto c = e->AsCall();
+ auto* c = e->AsCall();
ASSERT_TRUE(c->func()->IsIdentifier());
- auto func = c->func()->AsIdentifier();
- ASSERT_EQ(func->name().size(), 2);
+ auto* func = c->func()->AsIdentifier();
+ ASSERT_EQ(func->name().size(), 2u);
EXPECT_EQ(func->name()[0], "std");
EXPECT_EQ(func->name()[1], "test");
- EXPECT_EQ(c->params().size(), 3);
+ EXPECT_EQ(c->params().size(), 3u);
EXPECT_TRUE(c->params()[0]->IsConstructor());
EXPECT_TRUE(c->params()[1]->IsIdentifier());
EXPECT_TRUE(c->params()[2]->IsBinary());
}
TEST_F(ParserImplTest, PostfixExpression_Call_InvalidArg) {
- auto p = parser("a(if(a) {})");
+ auto* p = parser("a(if(a) {})");
auto e = p->postfix_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -139,7 +139,7 @@
}
TEST_F(ParserImplTest, PostfixExpression_Call_HangingComma) {
- auto p = parser("a(b, )");
+ auto* p = parser("a(b, )");
auto e = p->postfix_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -147,7 +147,7 @@
}
TEST_F(ParserImplTest, PostfixExpression_Call_MissingRightParen) {
- auto p = parser("a(");
+ auto* p = parser("a(");
auto e = p->postfix_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -155,24 +155,24 @@
}
TEST_F(ParserImplTest, PostfixExpression_MemberAccessor) {
- auto p = parser("a.b");
+ auto* p = parser("a.b");
auto e = p->postfix_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsMemberAccessor());
- auto m = e->AsMemberAccessor();
+ auto* m = e->AsMemberAccessor();
ASSERT_TRUE(m->structure()->IsIdentifier());
- ASSERT_EQ(m->structure()->AsIdentifier()->name().size(), 1);
+ ASSERT_EQ(m->structure()->AsIdentifier()->name().size(), 1u);
EXPECT_EQ(m->structure()->AsIdentifier()->name()[0], "a");
ASSERT_TRUE(m->member()->IsIdentifier());
- ASSERT_EQ(m->member()->AsIdentifier()->name().size(), 1);
+ ASSERT_EQ(m->member()->AsIdentifier()->name().size(), 1u);
EXPECT_EQ(m->member()->AsIdentifier()->name()[0], "b");
}
TEST_F(ParserImplTest, PostfixExpression_MemberAccesssor_InvalidIdent) {
- auto p = parser("a.if");
+ auto* p = parser("a.if");
auto e = p->postfix_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -180,7 +180,7 @@
}
TEST_F(ParserImplTest, PostfixExpression_MemberAccessor_MissingIdent) {
- auto p = parser("a.");
+ auto* p = parser("a.");
auto e = p->postfix_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -188,7 +188,7 @@
}
TEST_F(ParserImplTest, PostfixExpression_NonMatch_returnLHS) {
- auto p = parser("a b");
+ auto* p = parser("a b");
auto e = p->postfix_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_primary_expression_test.cc b/src/reader/wgsl/parser_impl_primary_expression_test.cc
index ae0c9c3..29f11a3 100644
--- a/src/reader/wgsl/parser_impl_primary_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_primary_expression_test.cc
@@ -36,24 +36,24 @@
namespace {
TEST_F(ParserImplTest, PrimaryExpression_Ident) {
- auto p = parser("a");
+ auto* p = parser("a");
auto e = p->primary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsIdentifier());
- auto ident = e->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = e->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, PrimaryExpression_Ident_WithNamespace) {
- auto p = parser("a::b::c::d");
+ auto* p = parser("a::b::c::d");
auto e = p->primary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsIdentifier());
- auto ident = e->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 4);
+ auto* ident = e->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 4u);
EXPECT_EQ(ident->name()[0], "a");
EXPECT_EQ(ident->name()[1], "b");
EXPECT_EQ(ident->name()[2], "c");
@@ -61,7 +61,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_Ident_MissingIdent) {
- auto p = parser("a::");
+ auto* p = parser("a::");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -69,19 +69,19 @@
}
TEST_F(ParserImplTest, PrimaryExpression_TypeDecl) {
- auto p = parser("vec4<i32>(1, 2, 3, 4))");
+ auto* p = parser("vec4<i32>(1, 2, 3, 4))");
auto e = p->primary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsConstructor());
ASSERT_TRUE(e->AsConstructor()->IsTypeConstructor());
- auto ty = e->AsConstructor()->AsTypeConstructor();
+ auto* ty = e->AsConstructor()->AsTypeConstructor();
- ASSERT_EQ(ty->values().size(), 4);
+ ASSERT_EQ(ty->values().size(), 4u);
const auto& val = ty->values();
ASSERT_TRUE(val[0]->IsConstructor());
ASSERT_TRUE(val[0]->AsConstructor()->IsScalarConstructor());
- auto ident = val[0]->AsConstructor()->AsScalarConstructor();
+ auto* ident = val[0]->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(ident->literal()->IsInt());
EXPECT_EQ(ident->literal()->AsInt()->value(), 1);
@@ -105,7 +105,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_InvalidTypeDecl) {
- auto p = parser("vec4<if>(2., 3., 4., 5.)");
+ auto* p = parser("vec4<if>(2., 3., 4., 5.)");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -113,7 +113,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_MissingLeftParen) {
- auto p = parser("vec4<f32> 2., 3., 4., 5.)");
+ auto* p = parser("vec4<f32> 2., 3., 4., 5.)");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -121,7 +121,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_MissingRightParen) {
- auto p = parser("vec4<f32>(2., 3., 4., 5.");
+ auto* p = parser("vec4<f32>(2., 3., 4., 5.");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -129,7 +129,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_InvalidValue) {
- auto p = parser("i32(if(a) {})");
+ auto* p = parser("i32(if(a) {})");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -137,19 +137,19 @@
}
TEST_F(ParserImplTest, PrimaryExpression_ConstLiteral_True) {
- auto p = parser("true");
+ auto* p = parser("true");
auto e = p->primary_expression();
ASSERT_FALSE(p->has_error());
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsConstructor());
ASSERT_TRUE(e->AsConstructor()->IsScalarConstructor());
- auto init = e->AsConstructor()->AsScalarConstructor();
+ auto* init = e->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
EXPECT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, PrimaryExpression_ParenExpr) {
- auto p = parser("(a == b)");
+ auto* p = parser("(a == b)");
auto e = p->primary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -157,7 +157,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_ParenExpr_MissingRightParen) {
- auto p = parser("(a == b");
+ auto* p = parser("(a == b");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -165,7 +165,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_ParenExpr_MissingExpr) {
- auto p = parser("()");
+ auto* p = parser("()");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -173,7 +173,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_ParenExpr_InvalidExpr) {
- auto p = parser("(if (a) {})");
+ auto* p = parser("(if (a) {})");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -181,15 +181,15 @@
}
TEST_F(ParserImplTest, PrimaryExpression_Cast) {
- auto f32_type = tm()->Get(std::make_unique<ast::type::F32Type>());
+ auto* f32_type = tm()->Get(std::make_unique<ast::type::F32Type>());
- auto p = parser("cast<f32>(1)");
+ auto* p = parser("cast<f32>(1)");
auto e = p->primary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsCast());
- auto c = e->AsCast();
+ auto* c = e->AsCast();
ASSERT_EQ(c->type(), f32_type);
ASSERT_TRUE(c->expr()->IsConstructor());
@@ -197,7 +197,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_Cast_MissingGreaterThan) {
- auto p = parser("cast<f32(1)");
+ auto* p = parser("cast<f32(1)");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -205,7 +205,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_Cast_MissingType) {
- auto p = parser("cast<>(1)");
+ auto* p = parser("cast<>(1)");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -213,7 +213,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_Cast_InvalidType) {
- auto p = parser("cast<invalid>(1)");
+ auto* p = parser("cast<invalid>(1)");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -221,7 +221,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_Cast_MissingLeftParen) {
- auto p = parser("cast<f32>1)");
+ auto* p = parser("cast<f32>1)");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -229,7 +229,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_Cast_MissingRightParen) {
- auto p = parser("cast<f32>(1");
+ auto* p = parser("cast<f32>(1");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -237,7 +237,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_Cast_MissingExpression) {
- auto p = parser("cast<f32>()");
+ auto* p = parser("cast<f32>()");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -245,7 +245,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_Cast_InvalidExpression) {
- auto p = parser("cast<f32>(if (a) {})");
+ auto* p = parser("cast<f32>(if (a) {})");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -253,15 +253,15 @@
}
TEST_F(ParserImplTest, PrimaryExpression_As) {
- auto f32_type = tm()->Get(std::make_unique<ast::type::F32Type>());
+ auto* f32_type = tm()->Get(std::make_unique<ast::type::F32Type>());
- auto p = parser("as<f32>(1)");
+ auto* p = parser("as<f32>(1)");
auto e = p->primary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsAs());
- auto c = e->AsAs();
+ auto* c = e->AsAs();
ASSERT_EQ(c->type(), f32_type);
ASSERT_TRUE(c->expr()->IsConstructor());
@@ -269,7 +269,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_As_MissingGreaterThan) {
- auto p = parser("as<f32(1)");
+ auto* p = parser("as<f32(1)");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -277,7 +277,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_As_MissingType) {
- auto p = parser("as<>(1)");
+ auto* p = parser("as<>(1)");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -285,7 +285,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_As_InvalidType) {
- auto p = parser("as<invalid>(1)");
+ auto* p = parser("as<invalid>(1)");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -293,7 +293,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_As_MissingLeftParen) {
- auto p = parser("as<f32>1)");
+ auto* p = parser("as<f32>1)");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -301,7 +301,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_As_MissingRightParen) {
- auto p = parser("as<f32>(1");
+ auto* p = parser("as<f32>(1");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -309,7 +309,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_As_MissingExpression) {
- auto p = parser("as<f32>()");
+ auto* p = parser("as<f32>()");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -317,7 +317,7 @@
}
TEST_F(ParserImplTest, PrimaryExpression_As_InvalidExpression) {
- auto p = parser("as<f32>(if (a) {})");
+ auto* p = parser("as<f32>(if (a) {})");
auto e = p->primary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_relational_expression_test.cc b/src/reader/wgsl/parser_impl_relational_expression_test.cc
index 1b4ab29..1151977 100644
--- a/src/reader/wgsl/parser_impl_relational_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_relational_expression_test.cc
@@ -26,102 +26,102 @@
namespace {
TEST_F(ParserImplTest, RelationalExpression_Parses_LessThan) {
- auto p = parser("a < true");
+ auto* p = parser("a < true");
auto e = p->relational_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kLessThan, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, RelationalExpression_Parses_GreaterThan) {
- auto p = parser("a > true");
+ auto* p = parser("a > true");
auto e = p->relational_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kGreaterThan, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, RelationalExpression_Parses_LessThanEqual) {
- auto p = parser("a <= true");
+ auto* p = parser("a <= true");
auto e = p->relational_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kLessThanEqual, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, RelationalExpression_Parses_GreaterThanEqual) {
- auto p = parser("a >= true");
+ auto* p = parser("a >= true");
auto e = p->relational_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kGreaterThanEqual, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, RelationalExpression_InvalidLHS) {
- auto p = parser("if (a) {} < true");
+ auto* p = parser("if (a) {} < true");
auto e = p->relational_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, nullptr);
}
TEST_F(ParserImplTest, RelationalExpression_InvalidRHS) {
- auto p = parser("true < if (a) {}");
+ auto* p = parser("true < if (a) {}");
auto e = p->relational_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -129,7 +129,7 @@
}
TEST_F(ParserImplTest, RelationalExpression_NoOr_ReturnsLHS) {
- auto p = parser("a true");
+ auto* p = parser("a true");
auto e = p->relational_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_shift_expression_test.cc b/src/reader/wgsl/parser_impl_shift_expression_test.cc
index 60c99ad..f6e8351 100644
--- a/src/reader/wgsl/parser_impl_shift_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_shift_expression_test.cc
@@ -26,80 +26,80 @@
namespace {
TEST_F(ParserImplTest, ShiftExpression_Parses_ShiftLeft) {
- auto p = parser("a << true");
+ auto* p = parser("a << true");
auto e = p->shift_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kShiftLeft, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, ShiftExpression_Parses_ShiftRight) {
- auto p = parser("a >> true");
+ auto* p = parser("a >> true");
auto e = p->shift_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kShiftRight, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, ShiftExpression_Parses_ShiftRightArith) {
- auto p = parser("a >>> true");
+ auto* p = parser("a >>> true");
auto e = p->shift_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsBinary());
- auto rel = e->AsBinary();
+ auto* rel = e->AsBinary();
EXPECT_EQ(ast::BinaryOp::kShiftRightArith, rel->op());
ASSERT_TRUE(rel->lhs()->IsIdentifier());
- auto ident = rel->lhs()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = rel->lhs()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(rel->rhs()->IsConstructor());
ASSERT_TRUE(rel->rhs()->AsConstructor()->IsScalarConstructor());
- auto init = rel->rhs()->AsConstructor()->AsScalarConstructor();
+ auto* init = rel->rhs()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsBool());
ASSERT_TRUE(init->literal()->AsBool()->IsTrue());
}
TEST_F(ParserImplTest, ShiftExpression_InvalidLHS) {
- auto p = parser("if (a) {} << true");
+ auto* p = parser("if (a) {} << true");
auto e = p->shift_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, nullptr);
}
TEST_F(ParserImplTest, ShiftExpression_InvalidRHS) {
- auto p = parser("true << if (a) {}");
+ auto* p = parser("true << if (a) {}");
auto e = p->shift_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -107,7 +107,7 @@
}
TEST_F(ParserImplTest, ShiftExpression_NoOr_ReturnsLHS) {
- auto p = parser("a true");
+ auto* p = parser("a true");
auto e = p->shift_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_statement_test.cc b/src/reader/wgsl/parser_impl_statement_test.cc
index 29ad4f8..f123437 100644
--- a/src/reader/wgsl/parser_impl_statement_test.cc
+++ b/src/reader/wgsl/parser_impl_statement_test.cc
@@ -24,7 +24,7 @@
namespace {
TEST_F(ParserImplTest, Statement) {
- auto p = parser("return;");
+ auto* p = parser("return;");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -32,37 +32,37 @@
}
TEST_F(ParserImplTest, Statement_Semicolon) {
- auto p = parser(";");
+ auto* p = parser(";");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_EQ(e, nullptr);
}
TEST_F(ParserImplTest, Statement_Return_NoValue) {
- auto p = parser("return;");
+ auto* p = parser("return;");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsReturn());
- auto ret = e->AsReturn();
+ auto* ret = e->AsReturn();
ASSERT_EQ(ret->value(), nullptr);
}
TEST_F(ParserImplTest, Statement_Return_Value) {
- auto p = parser("return a + b * (.1 - .2);");
+ auto* p = parser("return a + b * (.1 - .2);");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsReturn());
- auto ret = e->AsReturn();
+ auto* ret = e->AsReturn();
ASSERT_NE(ret->value(), nullptr);
EXPECT_TRUE(ret->value()->IsBinary());
}
TEST_F(ParserImplTest, Statement_Return_MissingSemi) {
- auto p = parser("return");
+ auto* p = parser("return");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -70,7 +70,7 @@
}
TEST_F(ParserImplTest, Statement_Return_Invalid) {
- auto p = parser("return if(a) {};");
+ auto* p = parser("return if(a) {};");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -78,7 +78,7 @@
}
TEST_F(ParserImplTest, Statement_If) {
- auto p = parser("if (a) {}");
+ auto* p = parser("if (a) {}");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -86,7 +86,7 @@
}
TEST_F(ParserImplTest, Statement_If_Invalid) {
- auto p = parser("if (a) { fn main() -> {}}");
+ auto* p = parser("if (a) { fn main() -> {}}");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -94,7 +94,7 @@
}
TEST_F(ParserImplTest, Statement_Unless) {
- auto p = parser("unless (a) {}");
+ auto* p = parser("unless (a) {}");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -102,7 +102,7 @@
}
TEST_F(ParserImplTest, Statement_Unless_Invalid) {
- auto p = parser("unless () {}");
+ auto* p = parser("unless () {}");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -110,7 +110,7 @@
}
TEST_F(ParserImplTest, Statement_Variable) {
- auto p = parser("var a : i32 = 1;");
+ auto* p = parser("var a : i32 = 1;");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -118,7 +118,7 @@
}
TEST_F(ParserImplTest, Statement_Variable_Invalid) {
- auto p = parser("var a : i32 =;");
+ auto* p = parser("var a : i32 =;");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -126,7 +126,7 @@
}
TEST_F(ParserImplTest, Statement_Variable_MissingSemicolon) {
- auto p = parser("var a : i32");
+ auto* p = parser("var a : i32");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -134,7 +134,7 @@
}
TEST_F(ParserImplTest, Statement_Switch) {
- auto p = parser("switch (a) {}");
+ auto* p = parser("switch (a) {}");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -142,7 +142,7 @@
}
TEST_F(ParserImplTest, Statement_Switch_Invalid) {
- auto p = parser("switch (a) { case: {}}");
+ auto* p = parser("switch (a) { case: {}}");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -150,7 +150,7 @@
}
TEST_F(ParserImplTest, Statement_Loop) {
- auto p = parser("loop {}");
+ auto* p = parser("loop {}");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -158,7 +158,7 @@
}
TEST_F(ParserImplTest, Statement_Loop_Invalid) {
- auto p = parser("loop kill; }");
+ auto* p = parser("loop kill; }");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -166,7 +166,7 @@
}
TEST_F(ParserImplTest, Statement_Assignment) {
- auto p = parser("a = b;");
+ auto* p = parser("a = b;");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -174,7 +174,7 @@
}
TEST_F(ParserImplTest, Statement_Assignment_Invalid) {
- auto p = parser("a = if(b) {};");
+ auto* p = parser("a = if(b) {};");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -182,7 +182,7 @@
}
TEST_F(ParserImplTest, Statement_Assignment_MissingSemicolon) {
- auto p = parser("a = b");
+ auto* p = parser("a = b");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -190,7 +190,7 @@
}
TEST_F(ParserImplTest, Statement_Break) {
- auto p = parser("break;");
+ auto* p = parser("break;");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -198,7 +198,7 @@
}
TEST_F(ParserImplTest, Statement_Break_Invalid) {
- auto p = parser("break if (a = b);");
+ auto* p = parser("break if (a = b);");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -206,7 +206,7 @@
}
TEST_F(ParserImplTest, Statement_Break_MissingSemicolon) {
- auto p = parser("break if (a == b)");
+ auto* p = parser("break if (a == b)");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -214,7 +214,7 @@
}
TEST_F(ParserImplTest, Statement_Continue) {
- auto p = parser("continue;");
+ auto* p = parser("continue;");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -222,7 +222,7 @@
}
TEST_F(ParserImplTest, Statement_Continue_Invalid) {
- auto p = parser("continue if (a = b);");
+ auto* p = parser("continue if (a = b);");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -230,7 +230,7 @@
}
TEST_F(ParserImplTest, Statement_Continue_MissingSemicolon) {
- auto p = parser("continue if (a == b)");
+ auto* p = parser("continue if (a == b)");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -238,7 +238,7 @@
}
TEST_F(ParserImplTest, Statement_Kill) {
- auto p = parser("kill;");
+ auto* p = parser("kill;");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
EXPECT_NE(e, nullptr);
@@ -246,7 +246,7 @@
}
TEST_F(ParserImplTest, Statement_Kill_MissingSemicolon) {
- auto p = parser("kill");
+ auto* p = parser("kill");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(e, nullptr);
@@ -254,7 +254,7 @@
}
TEST_F(ParserImplTest, Statement_Nop) {
- auto p = parser("nop;");
+ auto* p = parser("nop;");
auto e = p->statement();
ASSERT_FALSE(p->has_error()) << p->error();
EXPECT_NE(e, nullptr);
@@ -262,7 +262,7 @@
}
TEST_F(ParserImplTest, Statement_Nop_MissingSemicolon) {
- auto p = parser("nop");
+ auto* p = parser("nop");
auto e = p->statement();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_statements_test.cc b/src/reader/wgsl/parser_impl_statements_test.cc
index 8a07abc..3e6a959 100644
--- a/src/reader/wgsl/parser_impl_statements_test.cc
+++ b/src/reader/wgsl/parser_impl_statements_test.cc
@@ -23,20 +23,20 @@
namespace {
TEST_F(ParserImplTest, Statements) {
- auto p = parser("nop; kill; return;");
+ auto* p = parser("nop; kill; return;");
auto e = p->statements();
ASSERT_FALSE(p->has_error()) << p->error();
- ASSERT_EQ(e.size(), 3);
+ ASSERT_EQ(e.size(), 3u);
EXPECT_TRUE(e[0]->IsNop());
EXPECT_TRUE(e[1]->IsKill());
EXPECT_TRUE(e[2]->IsReturn());
}
TEST_F(ParserImplTest, Statements_Empty) {
- auto p = parser("");
+ auto* p = parser("");
auto e = p->statements();
ASSERT_FALSE(p->has_error()) << p->error();
- ASSERT_EQ(e.size(), 0);
+ ASSERT_EQ(e.size(), 0u);
}
} // namespace
diff --git a/src/reader/wgsl/parser_impl_storage_class_test.cc b/src/reader/wgsl/parser_impl_storage_class_test.cc
index 923dd76..8a827ef 100644
--- a/src/reader/wgsl/parser_impl_storage_class_test.cc
+++ b/src/reader/wgsl/parser_impl_storage_class_test.cc
@@ -36,9 +36,9 @@
StorageClassTest() = default;
~StorageClassTest() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -52,7 +52,7 @@
TEST_P(StorageClassTest, Parses) {
auto params = GetParam();
- auto p = parser(params.input);
+ auto* p = parser(params.input);
auto sc = p->storage_class();
ASSERT_FALSE(p->has_error());
@@ -78,7 +78,7 @@
StorageClassData{"function", ast::StorageClass::kFunction}));
TEST_F(ParserImplTest, StorageClass_NoMatch) {
- auto p = parser("not-a-storage-class");
+ auto* p = parser("not-a-storage-class");
auto sc = p->storage_class();
ASSERT_EQ(sc, ast::StorageClass::kNone);
diff --git a/src/reader/wgsl/parser_impl_struct_body_decl_test.cc b/src/reader/wgsl/parser_impl_struct_body_decl_test.cc
index 0bee981..ecf29a9 100644
--- a/src/reader/wgsl/parser_impl_struct_body_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_struct_body_decl_test.cc
@@ -24,28 +24,28 @@
namespace {
TEST_F(ParserImplTest, StructBodyDecl_Parses) {
- auto i32 = tm()->Get(std::make_unique<ast::type::I32Type>());
+ auto* i32 = tm()->Get(std::make_unique<ast::type::I32Type>());
- auto p = parser("{a : i32;}");
+ auto* p = parser("{a : i32;}");
auto m = p->struct_body_decl();
ASSERT_FALSE(p->has_error());
- ASSERT_EQ(m.size(), 1);
+ ASSERT_EQ(m.size(), 1u);
const auto& mem = m[0];
EXPECT_EQ(mem->name(), "a");
EXPECT_EQ(mem->type(), i32);
- EXPECT_EQ(mem->decorations().size(), 0);
+ EXPECT_EQ(mem->decorations().size(), 0u);
}
TEST_F(ParserImplTest, StructBodyDecl_ParsesEmpty) {
- auto p = parser("{}");
+ auto* p = parser("{}");
auto m = p->struct_body_decl();
ASSERT_FALSE(p->has_error());
- ASSERT_EQ(m.size(), 0);
+ ASSERT_EQ(m.size(), 0u);
}
TEST_F(ParserImplTest, StructBodyDecl_InvalidMember) {
- auto p = parser(R"(
+ auto* p = parser(R"(
{
[[offset nan]] a : i32;
})");
@@ -55,14 +55,14 @@
}
TEST_F(ParserImplTest, StructBodyDecl_MissingClosingBracket) {
- auto p = parser("{a : i32;");
+ auto* p = parser("{a : i32;");
auto m = p->struct_body_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:10: missing } for struct declaration");
}
TEST_F(ParserImplTest, StructBodyDecl_InvalidToken) {
- auto p = parser(R"(
+ auto* p = parser(R"(
{
a : i32;
1.23
diff --git a/src/reader/wgsl/parser_impl_struct_decl_test.cc b/src/reader/wgsl/parser_impl_struct_decl_test.cc
index b409289..bb91899 100644
--- a/src/reader/wgsl/parser_impl_struct_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_struct_decl_test.cc
@@ -23,7 +23,7 @@
namespace {
TEST_F(ParserImplTest, StructDecl_Parses) {
- auto p = parser(R"(
+ auto* p = parser(R"(
struct {
a : i32;
[[offset 4 ]] b : f32;
@@ -31,13 +31,13 @@
auto s = p->struct_decl();
ASSERT_FALSE(p->has_error());
ASSERT_NE(s, nullptr);
- ASSERT_EQ(s->impl()->members().size(), 2);
+ ASSERT_EQ(s->impl()->members().size(), 2u);
EXPECT_EQ(s->impl()->members()[0]->name(), "a");
EXPECT_EQ(s->impl()->members()[1]->name(), "b");
}
TEST_F(ParserImplTest, StructDecl_ParsesWithDecoration) {
- auto p = parser(R"(
+ auto* p = parser(R"(
[[block]] struct {
a : f32;
b : f32;
@@ -45,21 +45,21 @@
auto s = p->struct_decl();
ASSERT_FALSE(p->has_error());
ASSERT_NE(s, nullptr);
- ASSERT_EQ(s->impl()->members().size(), 2);
+ ASSERT_EQ(s->impl()->members().size(), 2u);
EXPECT_EQ(s->impl()->members()[0]->name(), "a");
EXPECT_EQ(s->impl()->members()[1]->name(), "b");
}
TEST_F(ParserImplTest, StructDecl_EmptyMembers) {
- auto p = parser("struct {}");
+ auto* p = parser("struct {}");
auto s = p->struct_decl();
ASSERT_FALSE(p->has_error());
ASSERT_NE(s, nullptr);
- ASSERT_EQ(s->impl()->members().size(), 0);
+ ASSERT_EQ(s->impl()->members().size(), 0u);
}
TEST_F(ParserImplTest, StructDecl_MissingBracketLeft) {
- auto p = parser("struct }");
+ auto* p = parser("struct }");
auto s = p->struct_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(s, nullptr);
@@ -67,7 +67,7 @@
}
TEST_F(ParserImplTest, StructDecl_InvalidStructBody) {
- auto p = parser("struct { a : B; }");
+ auto* p = parser("struct { a : B; }");
auto s = p->struct_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(s, nullptr);
@@ -75,7 +75,7 @@
}
TEST_F(ParserImplTest, StructDecl_InvalidStructDecorationDecl) {
- auto p = parser("[[block struct { a : i32; }");
+ auto* p = parser("[[block struct { a : i32; }");
auto s = p->struct_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(s, nullptr);
@@ -83,7 +83,7 @@
}
TEST_F(ParserImplTest, StructDecl_MissingStruct) {
- auto p = parser("[[block]] {}");
+ auto* p = parser("[[block]] {}");
auto s = p->struct_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(s, nullptr);
diff --git a/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc
index a22bab0..c48dacf 100644
--- a/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc
@@ -22,21 +22,21 @@
namespace {
TEST_F(ParserImplTest, StructDecorationDecl_Parses) {
- auto p = parser("[[block]]");
+ auto* p = parser("[[block]]");
auto d = p->struct_decoration_decl();
ASSERT_FALSE(p->has_error());
EXPECT_EQ(d, ast::StructDecoration::kBlock);
}
TEST_F(ParserImplTest, StructDecorationDecl_MissingAttrRight) {
- auto p = parser("[[block");
+ auto* p = parser("[[block");
p->struct_decoration_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:8: missing ]] for struct decoration");
}
TEST_F(ParserImplTest, StructDecorationDecl_InvalidDecoration) {
- auto p = parser("[[invalid]]");
+ auto* p = parser("[[invalid]]");
p->struct_decoration_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:3: unknown struct decoration");
diff --git a/src/reader/wgsl/parser_impl_struct_decoration_test.cc b/src/reader/wgsl/parser_impl_struct_decoration_test.cc
index b87ecbe..518ac0b 100644
--- a/src/reader/wgsl/parser_impl_struct_decoration_test.cc
+++ b/src/reader/wgsl/parser_impl_struct_decoration_test.cc
@@ -37,9 +37,9 @@
StructDecorationTest() = default;
~StructDecorationTest() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -53,7 +53,7 @@
TEST_P(StructDecorationTest, Parses) {
auto params = GetParam();
- auto p = parser(params.input);
+ auto* p = parser(params.input);
auto deco = p->struct_decoration();
ASSERT_FALSE(p->has_error());
@@ -68,7 +68,7 @@
"block", ast::StructDecoration::kBlock}));
TEST_F(ParserImplTest, StructDecoration_NoMatch) {
- auto p = parser("not-a-stage");
+ auto* p = parser("not-a-stage");
auto deco = p->struct_decoration();
ASSERT_EQ(deco, ast::StructDecoration::kNone);
diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc
index 2fec9d6..ea54e9c 100644
--- a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc
@@ -23,43 +23,43 @@
namespace {
TEST_F(ParserImplTest, StructMemberDecorationDecl_EmptyStr) {
- auto p = parser("");
+ auto* p = parser("");
auto deco = p->struct_member_decoration_decl();
ASSERT_FALSE(p->has_error());
- EXPECT_EQ(deco.size(), 0);
+ EXPECT_EQ(deco.size(), 0u);
}
TEST_F(ParserImplTest, StructMemberDecorationDecl_EmptyBlock) {
- auto p = parser("[[]]");
+ auto* p = parser("[[]]");
auto deco = p->struct_member_decoration_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:3: empty struct member decoration found");
}
TEST_F(ParserImplTest, StructMemberDecorationDecl_Single) {
- auto p = parser("[[offset 4]]");
+ auto* p = parser("[[offset 4]]");
auto deco = p->struct_member_decoration_decl();
ASSERT_FALSE(p->has_error());
- ASSERT_EQ(deco.size(), 1);
+ ASSERT_EQ(deco.size(), 1u);
EXPECT_TRUE(deco[0]->IsOffset());
}
TEST_F(ParserImplTest, StructMemberDecorationDecl_HandlesDuplicate) {
- auto p = parser("[[offset 2, offset 4]]");
+ auto* p = parser("[[offset 2, offset 4]]");
auto deco = p->struct_member_decoration_decl();
ASSERT_TRUE(p->has_error()) << p->error();
EXPECT_EQ(p->error(), "1:21: duplicate offset decoration found");
}
TEST_F(ParserImplTest, StructMemberDecorationDecl_InvalidDecoration) {
- auto p = parser("[[offset nan]]");
+ auto* p = parser("[[offset nan]]");
auto deco = p->struct_member_decoration_decl();
ASSERT_TRUE(p->has_error()) << p->error();
EXPECT_EQ(p->error(), "1:10: invalid value for offset decoration");
}
TEST_F(ParserImplTest, StructMemberDecorationDecl_MissingClose) {
- auto p = parser("[[offset 4");
+ auto* p = parser("[[offset 4");
auto deco = p->struct_member_decoration_decl();
ASSERT_TRUE(p->has_error()) << p->error();
EXPECT_EQ(p->error(), "1:11: missing ]] for struct member decoration");
diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc
index 0bc2a92..7be4bce 100644
--- a/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc
+++ b/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc
@@ -23,18 +23,18 @@
namespace {
TEST_F(ParserImplTest, StructMemberDecoration_Offset) {
- auto p = parser("offset 4");
+ auto* p = parser("offset 4");
auto deco = p->struct_member_decoration();
ASSERT_NE(deco, nullptr);
ASSERT_FALSE(p->has_error());
ASSERT_TRUE(deco->IsOffset());
- auto o = deco->AsOffset();
- EXPECT_EQ(o->offset(), 4);
+ auto* o = deco->AsOffset();
+ EXPECT_EQ(o->offset(), 4u);
}
TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingValue) {
- auto p = parser("offset");
+ auto* p = parser("offset");
auto deco = p->struct_member_decoration();
ASSERT_EQ(deco, nullptr);
ASSERT_TRUE(p->has_error());
@@ -42,7 +42,7 @@
}
TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingInvalid) {
- auto p = parser("offset nan");
+ auto* p = parser("offset nan");
auto deco = p->struct_member_decoration();
ASSERT_EQ(deco, nullptr);
ASSERT_TRUE(p->has_error());
diff --git a/src/reader/wgsl/parser_impl_struct_member_test.cc b/src/reader/wgsl/parser_impl_struct_member_test.cc
index 3f630ef..49bc44c 100644
--- a/src/reader/wgsl/parser_impl_struct_member_test.cc
+++ b/src/reader/wgsl/parser_impl_struct_member_test.cc
@@ -25,35 +25,35 @@
namespace {
TEST_F(ParserImplTest, StructMember_Parses) {
- auto i32 = tm()->Get(std::make_unique<ast::type::I32Type>());
+ auto* i32 = tm()->Get(std::make_unique<ast::type::I32Type>());
- auto p = parser("a : i32;");
+ auto* p = parser("a : i32;");
auto m = p->struct_member();
ASSERT_FALSE(p->has_error());
ASSERT_NE(m, nullptr);
EXPECT_EQ(m->name(), "a");
EXPECT_EQ(m->type(), i32);
- EXPECT_EQ(m->decorations().size(), 0);
+ EXPECT_EQ(m->decorations().size(), 0u);
}
TEST_F(ParserImplTest, StructMember_ParsesWithDecoration) {
- auto i32 = tm()->Get(std::make_unique<ast::type::I32Type>());
+ auto* i32 = tm()->Get(std::make_unique<ast::type::I32Type>());
- auto p = parser("[[offset 2]] a : i32;");
+ auto* p = parser("[[offset 2]] a : i32;");
auto m = p->struct_member();
ASSERT_FALSE(p->has_error());
ASSERT_NE(m, nullptr);
EXPECT_EQ(m->name(), "a");
EXPECT_EQ(m->type(), i32);
- EXPECT_EQ(m->decorations().size(), 1);
+ EXPECT_EQ(m->decorations().size(), 1u);
EXPECT_TRUE(m->decorations()[0]->IsOffset());
- EXPECT_EQ(m->decorations()[0]->AsOffset()->offset(), 2);
+ EXPECT_EQ(m->decorations()[0]->AsOffset()->offset(), 2u);
}
TEST_F(ParserImplTest, StructMember_InvalidDecoration) {
- auto p = parser("[[offset nan]] a : i32;");
+ auto* p = parser("[[offset nan]] a : i32;");
auto m = p->struct_member();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(m, nullptr);
@@ -61,7 +61,7 @@
}
TEST_F(ParserImplTest, StructMember_InvalidVariable) {
- auto p = parser("[[offset 4]] a : B;");
+ auto* p = parser("[[offset 4]] a : B;");
auto m = p->struct_member();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(m, nullptr);
@@ -69,7 +69,7 @@
}
TEST_F(ParserImplTest, StructMember_MissingSemicolon) {
- auto p = parser("a : i32");
+ auto* p = parser("a : i32");
auto m = p->struct_member();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(m, nullptr);
diff --git a/src/reader/wgsl/parser_impl_switch_body_test.cc b/src/reader/wgsl/parser_impl_switch_body_test.cc
index a6780ff..dc85463 100644
--- a/src/reader/wgsl/parser_impl_switch_body_test.cc
+++ b/src/reader/wgsl/parser_impl_switch_body_test.cc
@@ -23,18 +23,18 @@
namespace {
TEST_F(ParserImplTest, SwitchBody_Case) {
- auto p = parser("case 1: { a = 4; }");
+ auto* p = parser("case 1: { a = 4; }");
auto e = p->switch_body();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsCase());
EXPECT_FALSE(e->IsDefault());
- ASSERT_EQ(e->body().size(), 1);
+ ASSERT_EQ(e->body().size(), 1u);
EXPECT_TRUE(e->body()[0]->IsAssign());
}
TEST_F(ParserImplTest, SwitchBody_Case_InvalidConstLiteral) {
- auto p = parser("case a == 4: { a = 4; }");
+ auto* p = parser("case a == 4: { a = 4; }");
auto e = p->switch_body();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -42,7 +42,7 @@
}
TEST_F(ParserImplTest, SwitchBody_Case_MissingConstLiteral) {
- auto p = parser("case: { a = 4; }");
+ auto* p = parser("case: { a = 4; }");
auto e = p->switch_body();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -50,7 +50,7 @@
}
TEST_F(ParserImplTest, SwitchBody_Case_MissingColon) {
- auto p = parser("case 1 { a = 4; }");
+ auto* p = parser("case 1 { a = 4; }");
auto e = p->switch_body();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -58,7 +58,7 @@
}
TEST_F(ParserImplTest, SwitchBody_Case_MissingBracketLeft) {
- auto p = parser("case 1: a = 4; }");
+ auto* p = parser("case 1: a = 4; }");
auto e = p->switch_body();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -66,7 +66,7 @@
}
TEST_F(ParserImplTest, SwitchBody_Case_MissingBracketRight) {
- auto p = parser("case 1: { a = 4; ");
+ auto* p = parser("case 1: { a = 4; ");
auto e = p->switch_body();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -74,7 +74,7 @@
}
TEST_F(ParserImplTest, SwitchBody_Case_InvalidCaseBody) {
- auto p = parser("case 1: { fn main() -> void {} }");
+ auto* p = parser("case 1: { fn main() -> void {} }");
auto e = p->switch_body();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -82,18 +82,18 @@
}
TEST_F(ParserImplTest, SwitchBody_Default) {
- auto p = parser("default: { a = 4; }");
+ auto* p = parser("default: { a = 4; }");
auto e = p->switch_body();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsCase());
EXPECT_TRUE(e->IsDefault());
- ASSERT_EQ(e->body().size(), 1);
+ ASSERT_EQ(e->body().size(), 1u);
EXPECT_TRUE(e->body()[0]->IsAssign());
}
TEST_F(ParserImplTest, SwitchBody_Default_MissingColon) {
- auto p = parser("default { a = 4; }");
+ auto* p = parser("default { a = 4; }");
auto e = p->switch_body();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -101,7 +101,7 @@
}
TEST_F(ParserImplTest, SwitchBody_Default_MissingBracketLeft) {
- auto p = parser("default: a = 4; }");
+ auto* p = parser("default: a = 4; }");
auto e = p->switch_body();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -109,7 +109,7 @@
}
TEST_F(ParserImplTest, SwitchBody_Default_MissingBracketRight) {
- auto p = parser("default: { a = 4; ");
+ auto* p = parser("default: { a = 4; ");
auto e = p->switch_body();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -117,7 +117,7 @@
}
TEST_F(ParserImplTest, SwitchBody_Default_InvalidCaseBody) {
- auto p = parser("default: { fn main() -> void {} }");
+ auto* p = parser("default: { fn main() -> void {} }");
auto e = p->switch_body();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_switch_stmt_test.cc b/src/reader/wgsl/parser_impl_switch_stmt_test.cc
index f9d9710..d0c98de 100644
--- a/src/reader/wgsl/parser_impl_switch_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_switch_stmt_test.cc
@@ -24,7 +24,7 @@
namespace {
TEST_F(ParserImplTest, SwitchStmt_WithoutDefault) {
- auto p = parser(R"(switch(a) {
+ auto* p = parser(R"(switch(a) {
case 1: {}
case 2: {}
})");
@@ -32,22 +32,22 @@
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsSwitch());
- ASSERT_EQ(e->body().size(), 2);
+ ASSERT_EQ(e->body().size(), 2u);
EXPECT_FALSE(e->body()[0]->IsDefault());
EXPECT_FALSE(e->body()[1]->IsDefault());
}
TEST_F(ParserImplTest, SwitchStmt_Empty) {
- auto p = parser("switch(a) { }");
+ auto* p = parser("switch(a) { }");
auto e = p->switch_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsSwitch());
- ASSERT_EQ(e->body().size(), 0);
+ ASSERT_EQ(e->body().size(), 0u);
}
TEST_F(ParserImplTest, SwitchStmt_DefaultInMiddle) {
- auto p = parser(R"(switch(a) {
+ auto* p = parser(R"(switch(a) {
case 1: {}
default: {}
case 2: {}
@@ -57,14 +57,14 @@
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsSwitch());
- ASSERT_EQ(e->body().size(), 3);
+ ASSERT_EQ(e->body().size(), 3u);
ASSERT_FALSE(e->body()[0]->IsDefault());
ASSERT_TRUE(e->body()[1]->IsDefault());
ASSERT_FALSE(e->body()[2]->IsDefault());
}
TEST_F(ParserImplTest, SwitchStmt_InvalidExpression) {
- auto p = parser("switch(a=b) {}");
+ auto* p = parser("switch(a=b) {}");
auto e = p->switch_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -72,7 +72,7 @@
}
TEST_F(ParserImplTest, SwitchStmt_MissingExpression) {
- auto p = parser("switch {}");
+ auto* p = parser("switch {}");
auto e = p->switch_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -80,7 +80,7 @@
}
TEST_F(ParserImplTest, SwitchStmt_MissingBracketLeft) {
- auto p = parser("switch(a) }");
+ auto* p = parser("switch(a) }");
auto e = p->switch_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -88,7 +88,7 @@
}
TEST_F(ParserImplTest, SwitchStmt_MissingBracketRight) {
- auto p = parser("switch(a) {");
+ auto* p = parser("switch(a) {");
auto e = p->switch_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -96,7 +96,7 @@
}
TEST_F(ParserImplTest, SwitchStmt_InvalidBody) {
- auto p = parser(R"(switch(a) {
+ auto* p = parser(R"(switch(a) {
case: {}
})");
auto e = p->switch_stmt();
diff --git a/src/reader/wgsl/parser_impl_test.cc b/src/reader/wgsl/parser_impl_test.cc
index 890be8c..022e09d 100644
--- a/src/reader/wgsl/parser_impl_test.cc
+++ b/src/reader/wgsl/parser_impl_test.cc
@@ -24,12 +24,12 @@
namespace {
TEST_F(ParserImplTest, Empty) {
- auto p = parser("");
+ auto* p = parser("");
ASSERT_TRUE(p->Parse()) << p->error();
}
TEST_F(ParserImplTest, Parses) {
- auto p = parser(R"(
+ auto* p = parser(R"(
import "GLSL.std.430" as glsl;
[[location 0]] var<out> gl_FragColor : vec4<f32>;
@@ -42,14 +42,14 @@
ASSERT_TRUE(p->Parse()) << p->error();
auto m = p->module();
- ASSERT_EQ(1, m.imports().size());
- ASSERT_EQ(1, m.entry_points().size());
- ASSERT_EQ(1, m.functions().size());
- ASSERT_EQ(1, m.global_variables().size());
+ ASSERT_EQ(1u, m.imports().size());
+ ASSERT_EQ(1u, m.entry_points().size());
+ ASSERT_EQ(1u, m.functions().size());
+ ASSERT_EQ(1u, m.global_variables().size());
}
TEST_F(ParserImplTest, HandlesError) {
- auto p = parser(R"(
+ auto* p = parser(R"(
import "GLSL.std.430" as glsl;
fn main() -> { # missing return type
@@ -62,18 +62,18 @@
}
TEST_F(ParserImplTest, GetRegisteredType) {
- auto p = parser("");
+ auto* p = parser("");
ast::type::I32Type i32;
p->register_alias("my_alias", &i32);
- auto alias = p->get_alias("my_alias");
+ auto* alias = p->get_alias("my_alias");
ASSERT_NE(alias, nullptr);
ASSERT_EQ(alias, &i32);
}
TEST_F(ParserImplTest, GetUnregisteredType) {
- auto p = parser("");
- auto alias = p->get_alias("my_alias");
+ auto* p = parser("");
+ auto* alias = p->get_alias("my_alias");
ASSERT_EQ(alias, nullptr);
}
diff --git a/src/reader/wgsl/parser_impl_test_helper.cc b/src/reader/wgsl/parser_impl_test_helper.cc
new file mode 100644
index 0000000..d3746cf
--- /dev/null
+++ b/src/reader/wgsl/parser_impl_test_helper.cc
@@ -0,0 +1,34 @@
+// Copyright 2020 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+#include "src/reader/wgsl/parser_impl_test_helper.h"
+
+namespace tint {
+namespace reader {
+namespace wgsl {
+
+ParserImplTest::ParserImplTest() = default;
+
+ParserImplTest::~ParserImplTest() = default;
+
+void ParserImplTest::SetUp() {
+ ctx_.Reset();
+}
+
+void ParserImplTest::TearDown() {
+ impl_ = nullptr;
+}
+
+} // namespace wgsl
+} // namespace reader
+} // namespace tint
diff --git a/src/reader/wgsl/parser_impl_test_helper.h b/src/reader/wgsl/parser_impl_test_helper.h
index fd177e9..bdb1a29 100644
--- a/src/reader/wgsl/parser_impl_test_helper.h
+++ b/src/reader/wgsl/parser_impl_test_helper.h
@@ -30,14 +30,14 @@
class ParserImplTest : public testing::Test {
public:
/// Constructor
- ParserImplTest() = default;
- ~ParserImplTest() = default;
+ ParserImplTest();
+ ~ParserImplTest() override;
/// Sets up the test helper
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override;
/// Tears down the test helper
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override;
/// Retrieves the parser from the helper
/// @param str the string to parse
diff --git a/src/reader/wgsl/parser_impl_type_alias_test.cc b/src/reader/wgsl/parser_impl_type_alias_test.cc
index e0dbacd..fde357e 100644
--- a/src/reader/wgsl/parser_impl_type_alias_test.cc
+++ b/src/reader/wgsl/parser_impl_type_alias_test.cc
@@ -26,10 +26,10 @@
namespace {
TEST_F(ParserImplTest, TypeDecl_ParsesType) {
- auto i32 = tm()->Get(std::make_unique<ast::type::I32Type>());
+ auto* i32 = tm()->Get(std::make_unique<ast::type::I32Type>());
- auto p = parser("type a = i32");
- auto t = p->type_alias();
+ auto* p = parser("type a = i32");
+ auto* t = p->type_alias();
ASSERT_FALSE(p->has_error());
ASSERT_NE(t, nullptr);
ASSERT_TRUE(t->type()->IsI32());
@@ -37,52 +37,52 @@
}
TEST_F(ParserImplTest, TypeDecl_ParsesStruct) {
- auto p = parser("type a = struct { b: i32; c: f32;}");
- auto t = p->type_alias();
+ auto* p = parser("type a = struct { b: i32; c: f32;}");
+ auto* t = p->type_alias();
ASSERT_FALSE(p->has_error());
ASSERT_NE(t, nullptr);
EXPECT_EQ(t->name(), "a");
ASSERT_TRUE(t->type()->IsStruct());
- auto s = t->type()->AsStruct();
- EXPECT_EQ(s->impl()->members().size(), 2);
+ auto* s = t->type()->AsStruct();
+ EXPECT_EQ(s->impl()->members().size(), 2u);
}
TEST_F(ParserImplTest, TypeDecl_MissingIdent) {
- auto p = parser("type = i32");
- auto t = p->type_alias();
+ auto* p = parser("type = i32");
+ auto* t = p->type_alias();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(t, nullptr);
EXPECT_EQ(p->error(), "1:6: missing identifier for type alias");
}
TEST_F(ParserImplTest, TypeDecl_InvalidIdent) {
- auto p = parser("type 123 = i32");
- auto t = p->type_alias();
+ auto* p = parser("type 123 = i32");
+ auto* t = p->type_alias();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(t, nullptr);
EXPECT_EQ(p->error(), "1:6: missing identifier for type alias");
}
TEST_F(ParserImplTest, TypeDecl_MissingEqual) {
- auto p = parser("type a i32");
- auto t = p->type_alias();
+ auto* p = parser("type a i32");
+ auto* t = p->type_alias();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(t, nullptr);
EXPECT_EQ(p->error(), "1:8: missing = for type alias");
}
TEST_F(ParserImplTest, TypeDecl_InvalidType) {
- auto p = parser("type a = B");
- auto t = p->type_alias();
+ auto* p = parser("type a = B");
+ auto* t = p->type_alias();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(t, nullptr);
EXPECT_EQ(p->error(), "1:10: unknown type alias 'B'");
}
TEST_F(ParserImplTest, TypeDecl_InvalidStruct) {
- auto p = parser("type a = [[block]] {}");
- auto t = p->type_alias();
+ auto* p = parser("type a = [[block]] {}");
+ auto* t = p->type_alias();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(t, nullptr);
EXPECT_EQ(p->error(), "1:20: missing struct declaration");
diff --git a/src/reader/wgsl/parser_impl_type_decl_test.cc b/src/reader/wgsl/parser_impl_type_decl_test.cc
index d8119ef..8399b2b 100644
--- a/src/reader/wgsl/parser_impl_type_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_type_decl_test.cc
@@ -33,80 +33,80 @@
namespace {
TEST_F(ParserImplTest, TypeDecl_Invalid) {
- auto p = parser("1234");
- auto t = p->type_decl();
+ auto* p = parser("1234");
+ auto* t = p->type_decl();
EXPECT_EQ(t, nullptr);
EXPECT_FALSE(p->has_error());
}
TEST_F(ParserImplTest, TypeDecl_Identifier) {
- auto p = parser("A");
+ auto* p = parser("A");
- auto int_type = tm()->Get(std::make_unique<ast::type::I32Type>());
+ auto* int_type = tm()->Get(std::make_unique<ast::type::I32Type>());
// Pre-register to make sure that it's the same type.
- auto alias_type =
+ auto* alias_type =
tm()->Get(std::make_unique<ast::type::AliasType>("A", int_type));
p->register_alias("A", alias_type);
- auto t = p->type_decl();
+ auto* t = p->type_decl();
ASSERT_NE(t, nullptr);
EXPECT_EQ(t, alias_type);
ASSERT_TRUE(t->IsAlias());
- auto alias = t->AsAlias();
+ auto* alias = t->AsAlias();
EXPECT_EQ(alias->name(), "A");
EXPECT_EQ(alias->type(), int_type);
}
TEST_F(ParserImplTest, TypeDecl_Identifier_NotFound) {
- auto p = parser("B");
+ auto* p = parser("B");
- auto t = p->type_decl();
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
EXPECT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:1: unknown type alias 'B'");
}
TEST_F(ParserImplTest, TypeDecl_Bool) {
- auto p = parser("bool");
+ auto* p = parser("bool");
- auto bool_type = tm()->Get(std::make_unique<ast::type::BoolType>());
+ auto* bool_type = tm()->Get(std::make_unique<ast::type::BoolType>());
- auto t = p->type_decl();
+ auto* t = p->type_decl();
ASSERT_NE(t, nullptr);
EXPECT_EQ(t, bool_type);
ASSERT_TRUE(t->IsBool());
}
TEST_F(ParserImplTest, TypeDecl_F32) {
- auto p = parser("f32");
+ auto* p = parser("f32");
- auto float_type = tm()->Get(std::make_unique<ast::type::F32Type>());
+ auto* float_type = tm()->Get(std::make_unique<ast::type::F32Type>());
- auto t = p->type_decl();
+ auto* t = p->type_decl();
ASSERT_NE(t, nullptr);
EXPECT_EQ(t, float_type);
ASSERT_TRUE(t->IsF32());
}
TEST_F(ParserImplTest, TypeDecl_I32) {
- auto p = parser("i32");
+ auto* p = parser("i32");
- auto int_type = tm()->Get(std::make_unique<ast::type::I32Type>());
+ auto* int_type = tm()->Get(std::make_unique<ast::type::I32Type>());
- auto t = p->type_decl();
+ auto* t = p->type_decl();
ASSERT_NE(t, nullptr);
EXPECT_EQ(t, int_type);
ASSERT_TRUE(t->IsI32());
}
TEST_F(ParserImplTest, TypeDecl_U32) {
- auto p = parser("u32");
+ auto* p = parser("u32");
- auto uint_type = tm()->Get(std::make_unique<ast::type::U32Type>());
+ auto* uint_type = tm()->Get(std::make_unique<ast::type::U32Type>());
- auto t = p->type_decl();
+ auto* t = p->type_decl();
ASSERT_NE(t, nullptr);
EXPECT_EQ(t, uint_type);
ASSERT_TRUE(t->IsU32());
@@ -125,9 +125,9 @@
VecTest() = default;
~VecTest() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -141,8 +141,8 @@
TEST_P(VecTest, Parse) {
auto params = GetParam();
- auto p = parser(params.input);
- auto t = p->type_decl();
+ auto* p = parser(params.input);
+ auto* t = p->type_decl();
ASSERT_NE(t, nullptr);
ASSERT_FALSE(p->has_error());
EXPECT_TRUE(t->IsVector());
@@ -159,9 +159,9 @@
VecMissingGreaterThanTest() = default;
~VecMissingGreaterThanTest() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -175,8 +175,8 @@
TEST_P(VecMissingGreaterThanTest, Handles_Missing_GreaterThan) {
auto params = GetParam();
- auto p = parser(params.input);
- auto t = p->type_decl();
+ auto* p = parser(params.input);
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:9: missing > for vector");
@@ -192,9 +192,9 @@
VecMissingLessThanTest() = default;
~VecMissingLessThanTest() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -208,8 +208,8 @@
TEST_P(VecMissingLessThanTest, Handles_Missing_GreaterThan) {
auto params = GetParam();
- auto p = parser(params.input);
- auto t = p->type_decl();
+ auto* p = parser(params.input);
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:5: missing < for vector");
@@ -225,9 +225,9 @@
VecBadType() = default;
~VecBadType() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -241,8 +241,8 @@
TEST_P(VecBadType, Handles_Unknown_Type) {
auto params = GetParam();
- auto p = parser(params.input);
- auto t = p->type_decl();
+ auto* p = parser(params.input);
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:6: unknown type alias 'unknown'");
@@ -258,9 +258,9 @@
VecMissingType() = default;
~VecMissingType() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -274,8 +274,8 @@
TEST_P(VecMissingType, Handles_Missing_Type) {
auto params = GetParam();
- auto p = parser(params.input);
- auto t = p->type_decl();
+ auto* p = parser(params.input);
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:6: unable to determine subtype for vector");
@@ -287,173 +287,173 @@
VecData{"vec4<>", 4}));
TEST_F(ParserImplTest, TypeDecl_Ptr) {
- auto p = parser("ptr<function, f32>");
- auto t = p->type_decl();
+ auto* p = parser("ptr<function, f32>");
+ auto* t = p->type_decl();
ASSERT_NE(t, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
ASSERT_TRUE(t->IsPointer());
- auto ptr = t->AsPointer();
+ auto* ptr = t->AsPointer();
ASSERT_TRUE(ptr->type()->IsF32());
ASSERT_EQ(ptr->storage_class(), ast::StorageClass::kFunction);
}
TEST_F(ParserImplTest, TypeDecl_Ptr_ToVec) {
- auto p = parser("ptr<function, vec2<f32>>");
- auto t = p->type_decl();
+ auto* p = parser("ptr<function, vec2<f32>>");
+ auto* t = p->type_decl();
ASSERT_NE(t, nullptr) << p->error();
ASSERT_FALSE(p->has_error());
ASSERT_TRUE(t->IsPointer());
- auto ptr = t->AsPointer();
+ auto* ptr = t->AsPointer();
ASSERT_TRUE(ptr->type()->IsVector());
ASSERT_EQ(ptr->storage_class(), ast::StorageClass::kFunction);
- auto vec = ptr->type()->AsVector();
- ASSERT_EQ(vec->size(), 2);
+ auto* vec = ptr->type()->AsVector();
+ ASSERT_EQ(vec->size(), 2u);
ASSERT_TRUE(vec->type()->IsF32());
}
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingLessThan) {
- auto p = parser("ptr private, f32>");
- auto t = p->type_decl();
+ auto* p = parser("ptr private, f32>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:5: missing < for ptr declaration");
}
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingGreaterThan) {
- auto p = parser("ptr<function, f32");
- auto t = p->type_decl();
+ auto* p = parser("ptr<function, f32");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:18: missing > for ptr declaration");
}
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingComma) {
- auto p = parser("ptr<function f32>");
- auto t = p->type_decl();
+ auto* p = parser("ptr<function f32>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:14: missing , for ptr declaration");
}
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingStorageClass) {
- auto p = parser("ptr<, f32>");
- auto t = p->type_decl();
+ auto* p = parser("ptr<, f32>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:5: missing storage class for ptr declaration");
}
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingParams) {
- auto p = parser("ptr<>");
- auto t = p->type_decl();
+ auto* p = parser("ptr<>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:5: missing storage class for ptr declaration");
}
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingType) {
- auto p = parser("ptr<function,>");
- auto t = p->type_decl();
+ auto* p = parser("ptr<function,>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:14: missing type for ptr declaration");
}
TEST_F(ParserImplTest, TypeDecl_Ptr_BadStorageClass) {
- auto p = parser("ptr<unknown, f32>");
- auto t = p->type_decl();
+ auto* p = parser("ptr<unknown, f32>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:5: missing storage class for ptr declaration");
}
TEST_F(ParserImplTest, TypeDecl_Ptr_BadType) {
- auto p = parser("ptr<function, unknown>");
- auto t = p->type_decl();
+ auto* p = parser("ptr<function, unknown>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:15: unknown type alias 'unknown'");
}
TEST_F(ParserImplTest, TypeDecl_Array) {
- auto p = parser("array<f32, 5>");
- auto t = p->type_decl();
+ auto* p = parser("array<f32, 5>");
+ auto* t = p->type_decl();
ASSERT_NE(t, nullptr);
ASSERT_FALSE(p->has_error());
ASSERT_TRUE(t->IsArray());
- auto a = t->AsArray();
+ auto* a = t->AsArray();
ASSERT_FALSE(a->IsRuntimeArray());
- ASSERT_EQ(a->size(), 5);
+ ASSERT_EQ(a->size(), 5u);
ASSERT_TRUE(a->type()->IsF32());
}
TEST_F(ParserImplTest, TypeDecl_Array_Runtime) {
- auto p = parser("array<u32>");
- auto t = p->type_decl();
+ auto* p = parser("array<u32>");
+ auto* t = p->type_decl();
ASSERT_NE(t, nullptr);
ASSERT_FALSE(p->has_error());
ASSERT_TRUE(t->IsArray());
- auto a = t->AsArray();
+ auto* a = t->AsArray();
ASSERT_TRUE(a->IsRuntimeArray());
ASSERT_TRUE(a->type()->IsU32());
}
TEST_F(ParserImplTest, TypeDecl_Array_BadType) {
- auto p = parser("array<unknown, 3>");
- auto t = p->type_decl();
+ auto* p = parser("array<unknown, 3>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:7: unknown type alias 'unknown'");
}
TEST_F(ParserImplTest, TypeDecl_Array_ZeroSize) {
- auto p = parser("array<f32, 0>");
- auto t = p->type_decl();
+ auto* p = parser("array<f32, 0>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:12: invalid size for array declaration");
}
TEST_F(ParserImplTest, TypeDecl_Array_NegativeSize) {
- auto p = parser("array<f32, -1>");
- auto t = p->type_decl();
+ auto* p = parser("array<f32, -1>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:12: invalid size for array declaration");
}
TEST_F(ParserImplTest, TypeDecl_Array_BadSize) {
- auto p = parser("array<f32, invalid>");
- auto t = p->type_decl();
+ auto* p = parser("array<f32, invalid>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:12: missing size of array declaration");
}
TEST_F(ParserImplTest, TypeDecl_Array_MissingLessThan) {
- auto p = parser("array f32>");
- auto t = p->type_decl();
+ auto* p = parser("array f32>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:7: missing < for array declaration");
}
TEST_F(ParserImplTest, TypeDecl_Array_MissingGreaterThan) {
- auto p = parser("array<f32");
- auto t = p->type_decl();
+ auto* p = parser("array<f32");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:10: missing > for array declaration");
}
TEST_F(ParserImplTest, TypeDecl_Array_MissingComma) {
- auto p = parser("array<f32 3>");
- auto t = p->type_decl();
+ auto* p = parser("array<f32 3>");
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:11: missing > for array declaration");
@@ -473,9 +473,9 @@
MatrixTest() = default;
~MatrixTest() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -489,12 +489,12 @@
TEST_P(MatrixTest, Parse) {
auto params = GetParam();
- auto p = parser(params.input);
- auto t = p->type_decl();
+ auto* p = parser(params.input);
+ auto* t = p->type_decl();
ASSERT_NE(t, nullptr);
ASSERT_FALSE(p->has_error());
EXPECT_TRUE(t->IsMatrix());
- auto mat = t->AsMatrix();
+ auto* mat = t->AsMatrix();
EXPECT_EQ(mat->rows(), params.rows);
EXPECT_EQ(mat->columns(), params.columns);
}
@@ -515,9 +515,9 @@
MatrixMissingGreaterThanTest() = default;
~MatrixMissingGreaterThanTest() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -530,8 +530,8 @@
};
TEST_P(MatrixMissingGreaterThanTest, Handles_Missing_GreaterThan) {
auto params = GetParam();
- auto p = parser(params.input);
- auto t = p->type_decl();
+ auto* p = parser(params.input);
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:11: missing > for matrix");
@@ -553,9 +553,9 @@
MatrixMissingLessThanTest() = default;
~MatrixMissingLessThanTest() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -568,8 +568,8 @@
};
TEST_P(MatrixMissingLessThanTest, Handles_Missing_GreaterThan) {
auto params = GetParam();
- auto p = parser(params.input);
- auto t = p->type_decl();
+ auto* p = parser(params.input);
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:8: missing < for matrix");
@@ -591,9 +591,9 @@
MatrixBadType() = default;
~MatrixBadType() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -606,8 +606,8 @@
};
TEST_P(MatrixBadType, Handles_Unknown_Type) {
auto params = GetParam();
- auto p = parser(params.input);
- auto t = p->type_decl();
+ auto* p = parser(params.input);
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:8: unknown type alias 'unknown'");
@@ -629,9 +629,9 @@
MatrixMissingType() = default;
~MatrixMissingType() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -644,8 +644,8 @@
};
TEST_P(MatrixMissingType, Handles_Missing_Type) {
auto params = GetParam();
- auto p = parser(params.input);
- auto t = p->type_decl();
+ auto* p = parser(params.input);
+ auto* t = p->type_decl();
ASSERT_EQ(t, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:8: unable to determine subtype for matrix");
diff --git a/src/reader/wgsl/parser_impl_unary_expression_test.cc b/src/reader/wgsl/parser_impl_unary_expression_test.cc
index 090c9af..5d1b578 100644
--- a/src/reader/wgsl/parser_impl_unary_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_unary_expression_test.cc
@@ -29,45 +29,45 @@
namespace {
TEST_F(ParserImplTest, UnaryExpression_Postix) {
- auto p = parser("a[2]");
+ auto* p = parser("a[2]");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsArrayAccessor());
- auto ary = e->AsArrayAccessor();
+ auto* ary = e->AsArrayAccessor();
ASSERT_TRUE(ary->array()->IsIdentifier());
- auto ident = ary->array()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = ary->array()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(ary->idx_expr()->IsConstructor());
ASSERT_TRUE(ary->idx_expr()->AsConstructor()->IsScalarConstructor());
- auto init = ary->idx_expr()->AsConstructor()->AsScalarConstructor();
+ auto* init = ary->idx_expr()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsInt());
ASSERT_EQ(init->literal()->AsInt()->value(), 2);
}
TEST_F(ParserImplTest, UnaryExpression_Minus) {
- auto p = parser("- 1");
+ auto* p = parser("- 1");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryOp());
- auto u = e->AsUnaryOp();
+ auto* u = e->AsUnaryOp();
ASSERT_EQ(u->op(), ast::UnaryOp::kNegation);
ASSERT_TRUE(u->expr()->IsConstructor());
ASSERT_TRUE(u->expr()->AsConstructor()->IsScalarConstructor());
- auto init = u->expr()->AsConstructor()->AsScalarConstructor();
+ auto* init = u->expr()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsInt());
EXPECT_EQ(init->literal()->AsInt()->value(), 1);
}
TEST_F(ParserImplTest, UnaryExpression_Minus_InvalidRHS) {
- auto p = parser("-if(a) {}");
+ auto* p = parser("-if(a) {}");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -75,25 +75,25 @@
}
TEST_F(ParserImplTest, UnaryExpression_Bang) {
- auto p = parser("!1");
+ auto* p = parser("!1");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryOp());
- auto u = e->AsUnaryOp();
+ auto* u = e->AsUnaryOp();
ASSERT_EQ(u->op(), ast::UnaryOp::kNot);
ASSERT_TRUE(u->expr()->IsConstructor());
ASSERT_TRUE(u->expr()->AsConstructor()->IsScalarConstructor());
- auto init = u->expr()->AsConstructor()->AsScalarConstructor();
+ auto* init = u->expr()->AsConstructor()->AsScalarConstructor();
ASSERT_TRUE(init->literal()->IsInt());
EXPECT_EQ(init->literal()->AsInt()->value(), 1);
}
TEST_F(ParserImplTest, UnaryExpression_Bang_InvalidRHS) {
- auto p = parser("!if (a) {}");
+ auto* p = parser("!if (a) {}");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -101,23 +101,23 @@
}
TEST_F(ParserImplTest, UnaryExpression_Any) {
- auto p = parser("any(a)");
+ auto* p = parser("any(a)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryMethod());
- auto u = e->AsUnaryMethod();
+ auto* u = e->AsUnaryMethod();
ASSERT_EQ(u->op(), ast::UnaryMethod::kAny);
- ASSERT_EQ(u->params().size(), 1);
+ ASSERT_EQ(u->params().size(), 1u);
ASSERT_TRUE(u->params()[0]->IsIdentifier());
- auto ident = u->params()[0]->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = u->params()[0]->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, UnaryExpression_Any_MissingParenLeft) {
- auto p = parser("any a)");
+ auto* p = parser("any a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -125,7 +125,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Any_MissingParenRight) {
- auto p = parser("any(a");
+ auto* p = parser("any(a");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -133,7 +133,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Any_MissingIdentifier) {
- auto p = parser("any()");
+ auto* p = parser("any()");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -141,7 +141,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Any_InvalidIdentifier) {
- auto p = parser("any(123)");
+ auto* p = parser("any(123)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -149,23 +149,23 @@
}
TEST_F(ParserImplTest, UnaryExpression_All) {
- auto p = parser("all(a)");
+ auto* p = parser("all(a)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryMethod());
- auto u = e->AsUnaryMethod();
+ auto* u = e->AsUnaryMethod();
ASSERT_EQ(u->op(), ast::UnaryMethod::kAll);
- ASSERT_EQ(u->params().size(), 1);
+ ASSERT_EQ(u->params().size(), 1u);
ASSERT_TRUE(u->params()[0]->IsIdentifier());
- auto ident = u->params()[0]->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = u->params()[0]->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, UnaryExpression_All_MissingParenLeft) {
- auto p = parser("all a)");
+ auto* p = parser("all a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -173,7 +173,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_All_MissingParenRight) {
- auto p = parser("all(a");
+ auto* p = parser("all(a");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -181,7 +181,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_All_MissingIdentifier) {
- auto p = parser("all()");
+ auto* p = parser("all()");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -189,7 +189,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_All_InvalidIdentifier) {
- auto p = parser("all(123)");
+ auto* p = parser("all(123)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -197,23 +197,23 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsNan) {
- auto p = parser("is_nan(a)");
+ auto* p = parser("is_nan(a)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryMethod());
- auto u = e->AsUnaryMethod();
+ auto* u = e->AsUnaryMethod();
ASSERT_EQ(u->op(), ast::UnaryMethod::kIsNan);
- ASSERT_EQ(u->params().size(), 1);
+ ASSERT_EQ(u->params().size(), 1u);
ASSERT_TRUE(u->params()[0]->IsIdentifier());
- auto ident = u->params()[0]->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = u->params()[0]->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, UnaryExpression_IsNan_MissingParenLeft) {
- auto p = parser("is_nan a)");
+ auto* p = parser("is_nan a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -221,7 +221,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsNan_MissingParenRight) {
- auto p = parser("is_nan(a");
+ auto* p = parser("is_nan(a");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -229,7 +229,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsNan_MissingIdentifier) {
- auto p = parser("is_nan()");
+ auto* p = parser("is_nan()");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -237,7 +237,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsNan_InvalidIdentifier) {
- auto p = parser("is_nan(123)");
+ auto* p = parser("is_nan(123)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -245,23 +245,23 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsInf) {
- auto p = parser("is_inf(a)");
+ auto* p = parser("is_inf(a)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryMethod());
- auto u = e->AsUnaryMethod();
+ auto* u = e->AsUnaryMethod();
ASSERT_EQ(u->op(), ast::UnaryMethod::kIsInf);
- ASSERT_EQ(u->params().size(), 1);
+ ASSERT_EQ(u->params().size(), 1u);
ASSERT_TRUE(u->params()[0]->IsIdentifier());
- auto ident = u->params()[0]->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = u->params()[0]->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, UnaryExpression_IsInf_MissingParenLeft) {
- auto p = parser("is_inf a)");
+ auto* p = parser("is_inf a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -269,7 +269,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsInf_MissingParenRight) {
- auto p = parser("is_inf(a");
+ auto* p = parser("is_inf(a");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -277,7 +277,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsInf_MissingIdentifier) {
- auto p = parser("is_inf()");
+ auto* p = parser("is_inf()");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -285,7 +285,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsInf_InvalidIdentifier) {
- auto p = parser("is_inf(123)");
+ auto* p = parser("is_inf(123)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -293,23 +293,23 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsFinite) {
- auto p = parser("is_finite(a)");
+ auto* p = parser("is_finite(a)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryMethod());
- auto u = e->AsUnaryMethod();
+ auto* u = e->AsUnaryMethod();
ASSERT_EQ(u->op(), ast::UnaryMethod::kIsFinite);
- ASSERT_EQ(u->params().size(), 1);
+ ASSERT_EQ(u->params().size(), 1u);
ASSERT_TRUE(u->params()[0]->IsIdentifier());
- auto ident = u->params()[0]->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = u->params()[0]->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, UnaryExpression_IsFinite_MissingParenLeft) {
- auto p = parser("is_finite a)");
+ auto* p = parser("is_finite a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -317,7 +317,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsFinite_MissingParenRight) {
- auto p = parser("is_finite(a");
+ auto* p = parser("is_finite(a");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -325,7 +325,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsFinite_MissingIdentifier) {
- auto p = parser("is_finite()");
+ auto* p = parser("is_finite()");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -333,7 +333,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsFinite_InvalidIdentifier) {
- auto p = parser("is_finite(123)");
+ auto* p = parser("is_finite(123)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -341,23 +341,23 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsNormal) {
- auto p = parser("is_normal(a)");
+ auto* p = parser("is_normal(a)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryMethod());
- auto u = e->AsUnaryMethod();
+ auto* u = e->AsUnaryMethod();
ASSERT_EQ(u->op(), ast::UnaryMethod::kIsNormal);
- ASSERT_EQ(u->params().size(), 1);
+ ASSERT_EQ(u->params().size(), 1u);
ASSERT_TRUE(u->params()[0]->IsIdentifier());
- auto ident = u->params()[0]->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = u->params()[0]->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, UnaryExpression_IsNormal_MissingParenLeft) {
- auto p = parser("is_normal a)");
+ auto* p = parser("is_normal a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -365,7 +365,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsNormal_MissingParenRight) {
- auto p = parser("is_normal(a");
+ auto* p = parser("is_normal(a");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -373,7 +373,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsNormal_MissingIdentifier) {
- auto p = parser("is_normal()");
+ auto* p = parser("is_normal()");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -381,7 +381,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_IsNormal_InvalidIdentifier) {
- auto p = parser("is_normal(123)");
+ auto* p = parser("is_normal(123)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -389,28 +389,28 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dot) {
- auto p = parser("dot(a, b)");
+ auto* p = parser("dot(a, b)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryMethod());
- auto u = e->AsUnaryMethod();
+ auto* u = e->AsUnaryMethod();
ASSERT_EQ(u->op(), ast::UnaryMethod::kDot);
- ASSERT_EQ(u->params().size(), 2);
+ ASSERT_EQ(u->params().size(), 2u);
ASSERT_TRUE(u->params()[0]->IsIdentifier());
- auto ident = u->params()[0]->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = u->params()[0]->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(u->params()[1]->IsIdentifier());
ident = u->params()[1]->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "b");
}
TEST_F(ParserImplTest, UnaryExpression_Dot_MissingParenLeft) {
- auto p = parser("dot a, b)");
+ auto* p = parser("dot a, b)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -418,7 +418,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dot_MissingParenRight) {
- auto p = parser("dot(a, b");
+ auto* p = parser("dot(a, b");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -426,7 +426,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dot_MissingFirstIdentifier) {
- auto p = parser("dot(, a)");
+ auto* p = parser("dot(, a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -434,7 +434,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dot_MissingSecondIdentifier) {
- auto p = parser("dot(a, )");
+ auto* p = parser("dot(a, )");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -442,7 +442,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dot_MissingComma) {
- auto p = parser("dot(a b)");
+ auto* p = parser("dot(a b)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -450,7 +450,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dot_InvalidFirstIdentifier) {
- auto p = parser("dot(123, b)");
+ auto* p = parser("dot(123, b)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -458,7 +458,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dot_InvalidSecondIdentifier) {
- auto p = parser("dot(a, 123)");
+ auto* p = parser("dot(a, 123)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -466,28 +466,28 @@
}
TEST_F(ParserImplTest, UnaryExpression_OuterProduct) {
- auto p = parser("outer_product(a, b)");
+ auto* p = parser("outer_product(a, b)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryMethod());
- auto u = e->AsUnaryMethod();
+ auto* u = e->AsUnaryMethod();
ASSERT_EQ(u->op(), ast::UnaryMethod::kOuterProduct);
- ASSERT_EQ(u->params().size(), 2);
+ ASSERT_EQ(u->params().size(), 2u);
ASSERT_TRUE(u->params()[0]->IsIdentifier());
- auto ident = u->params()[0]->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = u->params()[0]->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
ASSERT_TRUE(u->params()[1]->IsIdentifier());
ident = u->params()[1]->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "b");
}
TEST_F(ParserImplTest, UnaryExpression_OuterProduct_MissingParenLeft) {
- auto p = parser("outer_product a, b)");
+ auto* p = parser("outer_product a, b)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -495,7 +495,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_OuterProduct_MissingParenRight) {
- auto p = parser("outer_product(a, b");
+ auto* p = parser("outer_product(a, b");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -503,7 +503,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_OuterProduct_MissingFirstIdentifier) {
- auto p = parser("outer_product(, b)");
+ auto* p = parser("outer_product(, b)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -511,7 +511,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_OuterProduct_MissingSecondIdentifier) {
- auto p = parser("outer_product(a, )");
+ auto* p = parser("outer_product(a, )");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -519,7 +519,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_OuterProduct_MissingComma) {
- auto p = parser("outer_product(a b)");
+ auto* p = parser("outer_product(a b)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -527,7 +527,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_OuterProduct_InvalidFirstIdentifier) {
- auto p = parser("outer_product(123, b)");
+ auto* p = parser("outer_product(123, b)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -535,7 +535,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_OuterProduct_InvalidSecondIdentifier) {
- auto p = parser("outer_product(a, 123)");
+ auto* p = parser("outer_product(a, 123)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -543,43 +543,43 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdx_NoModifier) {
- auto p = parser("dpdx(a)");
+ auto* p = parser("dpdx(a)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryDerivative());
- auto deriv = e->AsUnaryDerivative();
+ auto* deriv = e->AsUnaryDerivative();
EXPECT_EQ(deriv->op(), ast::UnaryDerivative::kDpdx);
EXPECT_EQ(deriv->modifier(), ast::DerivativeModifier::kNone);
ASSERT_NE(deriv->param(), nullptr);
ASSERT_TRUE(deriv->param()->IsIdentifier());
- auto ident = deriv->param()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = deriv->param()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, UnaryExpression_Dpdx_WithModifier) {
- auto p = parser("dpdx<coarse>(a)");
+ auto* p = parser("dpdx<coarse>(a)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryDerivative());
- auto deriv = e->AsUnaryDerivative();
+ auto* deriv = e->AsUnaryDerivative();
EXPECT_EQ(deriv->op(), ast::UnaryDerivative::kDpdx);
EXPECT_EQ(deriv->modifier(), ast::DerivativeModifier::kCoarse);
ASSERT_NE(deriv->param(), nullptr);
ASSERT_TRUE(deriv->param()->IsIdentifier());
- auto ident = deriv->param()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = deriv->param()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, UnaryExpression_Dpdx_MissingLessThan) {
- auto p = parser("dpdx coarse>(a)");
+ auto* p = parser("dpdx coarse>(a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -587,7 +587,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdx_InvalidModifier) {
- auto p = parser("dpdx<invalid>(a)");
+ auto* p = parser("dpdx<invalid>(a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -595,7 +595,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdx_EmptyModifer) {
- auto p = parser("dpdx coarse>(a)");
+ auto* p = parser("dpdx coarse>(a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -603,7 +603,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdx_MissingGreaterThan) {
- auto p = parser("dpdx<coarse (a)");
+ auto* p = parser("dpdx<coarse (a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -611,7 +611,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdx_MisisngLeftParen) {
- auto p = parser("dpdx<coarse>a)");
+ auto* p = parser("dpdx<coarse>a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -619,7 +619,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdx_MissingRightParen) {
- auto p = parser("dpdx<coarse>(a");
+ auto* p = parser("dpdx<coarse>(a");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -627,7 +627,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdx_MissingIdentifier) {
- auto p = parser("dpdx<coarse>()");
+ auto* p = parser("dpdx<coarse>()");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -635,7 +635,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdx_InvalidIdentifeir) {
- auto p = parser("dpdx<coarse>(12345)");
+ auto* p = parser("dpdx<coarse>(12345)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -643,43 +643,43 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdy_NoModifier) {
- auto p = parser("dpdy(a)");
+ auto* p = parser("dpdy(a)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryDerivative());
- auto deriv = e->AsUnaryDerivative();
+ auto* deriv = e->AsUnaryDerivative();
EXPECT_EQ(deriv->op(), ast::UnaryDerivative::kDpdy);
EXPECT_EQ(deriv->modifier(), ast::DerivativeModifier::kNone);
ASSERT_NE(deriv->param(), nullptr);
ASSERT_TRUE(deriv->param()->IsIdentifier());
- auto ident = deriv->param()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = deriv->param()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, UnaryExpression_Dpdy_WithModifier) {
- auto p = parser("dpdy<fine>(a)");
+ auto* p = parser("dpdy<fine>(a)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryDerivative());
- auto deriv = e->AsUnaryDerivative();
+ auto* deriv = e->AsUnaryDerivative();
EXPECT_EQ(deriv->op(), ast::UnaryDerivative::kDpdy);
EXPECT_EQ(deriv->modifier(), ast::DerivativeModifier::kFine);
ASSERT_NE(deriv->param(), nullptr);
ASSERT_TRUE(deriv->param()->IsIdentifier());
- auto ident = deriv->param()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = deriv->param()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, UnaryExpression_Dpdy_MissingLessThan) {
- auto p = parser("dpdy coarse>(a)");
+ auto* p = parser("dpdy coarse>(a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -687,7 +687,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdy_InvalidModifier) {
- auto p = parser("dpdy<invalid>(a)");
+ auto* p = parser("dpdy<invalid>(a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -695,7 +695,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdy_EmptyModifer) {
- auto p = parser("dpdy coarse>(a)");
+ auto* p = parser("dpdy coarse>(a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -703,7 +703,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdy_MissingGreaterThan) {
- auto p = parser("dpdy<coarse (a)");
+ auto* p = parser("dpdy<coarse (a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -711,7 +711,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdy_MisisngLeftParen) {
- auto p = parser("dpdy<coarse>a)");
+ auto* p = parser("dpdy<coarse>a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -719,7 +719,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdy_MissingRightParen) {
- auto p = parser("dpdy<coarse>(a");
+ auto* p = parser("dpdy<coarse>(a");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -727,7 +727,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdy_MissingIdentifier) {
- auto p = parser("dpdy<coarse>()");
+ auto* p = parser("dpdy<coarse>()");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -735,7 +735,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Dpdy_InvalidIdentifeir) {
- auto p = parser("dpdy<coarse>(12345)");
+ auto* p = parser("dpdy<coarse>(12345)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -743,43 +743,43 @@
}
TEST_F(ParserImplTest, UnaryExpression_Fwidth_NoModifier) {
- auto p = parser("fwidth(a)");
+ auto* p = parser("fwidth(a)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryDerivative());
- auto deriv = e->AsUnaryDerivative();
+ auto* deriv = e->AsUnaryDerivative();
EXPECT_EQ(deriv->op(), ast::UnaryDerivative::kFwidth);
EXPECT_EQ(deriv->modifier(), ast::DerivativeModifier::kNone);
ASSERT_NE(deriv->param(), nullptr);
ASSERT_TRUE(deriv->param()->IsIdentifier());
- auto ident = deriv->param()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = deriv->param()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, UnaryExpression_Fwidth_WithModifier) {
- auto p = parser("fwidth<coarse>(a)");
+ auto* p = parser("fwidth<coarse>(a)");
auto e = p->unary_expression();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnaryDerivative());
- auto deriv = e->AsUnaryDerivative();
+ auto* deriv = e->AsUnaryDerivative();
EXPECT_EQ(deriv->op(), ast::UnaryDerivative::kFwidth);
EXPECT_EQ(deriv->modifier(), ast::DerivativeModifier::kCoarse);
ASSERT_NE(deriv->param(), nullptr);
ASSERT_TRUE(deriv->param()->IsIdentifier());
- auto ident = deriv->param()->AsIdentifier();
- ASSERT_EQ(ident->name().size(), 1);
+ auto* ident = deriv->param()->AsIdentifier();
+ ASSERT_EQ(ident->name().size(), 1u);
EXPECT_EQ(ident->name()[0], "a");
}
TEST_F(ParserImplTest, UnaryExpression_Fwidth_MissingLessThan) {
- auto p = parser("fwidth coarse>(a)");
+ auto* p = parser("fwidth coarse>(a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -787,7 +787,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Fwidth_InvalidModifier) {
- auto p = parser("fwidth<invalid>(a)");
+ auto* p = parser("fwidth<invalid>(a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -795,7 +795,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Fwidth_EmptyModifer) {
- auto p = parser("fwidth coarse>(a)");
+ auto* p = parser("fwidth coarse>(a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -803,7 +803,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Fwidth_MissingGreaterThan) {
- auto p = parser("fwidth<coarse (a)");
+ auto* p = parser("fwidth<coarse (a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -811,7 +811,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Fwidth_MisisngLeftParen) {
- auto p = parser("fwidth<coarse>a)");
+ auto* p = parser("fwidth<coarse>a)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -819,7 +819,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Fwidth_MissingRightParen) {
- auto p = parser("fwidth<coarse>(a");
+ auto* p = parser("fwidth<coarse>(a");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -827,7 +827,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Fwidth_MissingIdentifier) {
- auto p = parser("fwidth<coarse>()");
+ auto* p = parser("fwidth<coarse>()");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -835,7 +835,7 @@
}
TEST_F(ParserImplTest, UnaryExpression_Fwidht_InvalidIdentifeir) {
- auto p = parser("fwidth<coarse>(12345)");
+ auto* p = parser("fwidth<coarse>(12345)");
auto e = p->unary_expression();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_unless_stmt_test.cc b/src/reader/wgsl/parser_impl_unless_stmt_test.cc
index 25cb4ef..4557c7c 100644
--- a/src/reader/wgsl/parser_impl_unless_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_unless_stmt_test.cc
@@ -22,19 +22,19 @@
namespace {
TEST_F(ParserImplTest, UnlessStmt) {
- auto p = parser("unless (a) { kill; }");
+ auto* p = parser("unless (a) { kill; }");
auto e = p->unless_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
ASSERT_TRUE(e->IsUnless());
ASSERT_NE(e->condition(), nullptr);
EXPECT_TRUE(e->condition()->IsIdentifier());
- ASSERT_EQ(e->body().size(), 1);
+ ASSERT_EQ(e->body().size(), 1u);
EXPECT_TRUE(e->body()[0]->IsKill());
}
TEST_F(ParserImplTest, UnlessStmt_InvalidCondition) {
- auto p = parser("unless(if(a){}) {}");
+ auto* p = parser("unless(if(a){}) {}");
auto e = p->unless_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -42,7 +42,7 @@
}
TEST_F(ParserImplTest, UnlessStmt_EmptyCondition) {
- auto p = parser("unless() {}");
+ auto* p = parser("unless() {}");
auto e = p->unless_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -50,7 +50,7 @@
}
TEST_F(ParserImplTest, UnlessStmt_InvalidBody) {
- auto p = parser("unless(a + 2 - 5 == true) { kill }");
+ auto* p = parser("unless(a + 2 - 5 == true) { kill }");
auto e = p->unless_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_variable_decl_test.cc b/src/reader/wgsl/parser_impl_variable_decl_test.cc
index a4ca585..05519c7 100644
--- a/src/reader/wgsl/parser_impl_variable_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_variable_decl_test.cc
@@ -23,19 +23,19 @@
namespace {
TEST_F(ParserImplTest, VariableDecl_Parses) {
- auto p = parser("var my_var : f32");
+ auto* p = parser("var my_var : f32");
auto var = p->variable_decl();
ASSERT_FALSE(p->has_error());
ASSERT_NE(var, nullptr);
ASSERT_EQ(var->name(), "my_var");
ASSERT_NE(var->type(), nullptr);
- ASSERT_EQ(var->source().line, 1);
- ASSERT_EQ(var->source().column, 1);
+ ASSERT_EQ(var->source().line, 1u);
+ ASSERT_EQ(var->source().column, 1u);
ASSERT_TRUE(var->type()->IsF32());
}
TEST_F(ParserImplTest, VariableDecl_MissingVar) {
- auto p = parser("my_var : f32");
+ auto* p = parser("my_var : f32");
auto v = p->variable_decl();
ASSERT_EQ(v, nullptr);
ASSERT_FALSE(p->has_error());
@@ -45,7 +45,7 @@
}
TEST_F(ParserImplTest, VariableDecl_InvalidIdentDecl) {
- auto p = parser("var my_var f32");
+ auto* p = parser("var my_var f32");
auto v = p->variable_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(v, nullptr);
@@ -53,7 +53,7 @@
}
TEST_F(ParserImplTest, VariableDecl_WithStorageClass) {
- auto p = parser("var<private> my_var : f32");
+ auto* p = parser("var<private> my_var : f32");
auto v = p->variable_decl();
ASSERT_FALSE(p->has_error());
ASSERT_NE(v, nullptr);
@@ -63,7 +63,7 @@
}
TEST_F(ParserImplTest, VariableDecl_InvalidStorageClass) {
- auto p = parser("var<unknown> my_var : f32");
+ auto* p = parser("var<unknown> my_var : f32");
auto v = p->variable_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(v, nullptr);
diff --git a/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc b/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc
index 8552e7d..a93e21d 100644
--- a/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc
+++ b/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc
@@ -24,53 +24,53 @@
namespace {
TEST_F(ParserImplTest, VariableDecorationList_Parses) {
- auto p = parser(R"([[location 4, builtin position]])");
+ auto* p = parser(R"([[location 4, builtin position]])");
auto decos = p->variable_decoration_list();
ASSERT_FALSE(p->has_error());
- ASSERT_EQ(decos.size(), 2);
+ ASSERT_EQ(decos.size(), 2u);
ASSERT_TRUE(decos[0]->IsLocation());
- EXPECT_EQ(decos[0]->AsLocation()->value(), 4);
+ EXPECT_EQ(decos[0]->AsLocation()->value(), 4u);
ASSERT_TRUE(decos[1]->IsBuiltin());
EXPECT_EQ(decos[1]->AsBuiltin()->value(), ast::Builtin::kPosition);
}
TEST_F(ParserImplTest, VariableDecorationList_Empty) {
- auto p = parser(R"([[]])");
+ auto* p = parser(R"([[]])");
auto decos = p->variable_decoration_list();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:3: empty variable decoration list");
}
TEST_F(ParserImplTest, VariableDecorationList_Invalid) {
- auto p = parser(R"([[invalid]])");
+ auto* p = parser(R"([[invalid]])");
auto decos = p->variable_decoration_list();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:3: missing variable decoration for decoration list");
}
TEST_F(ParserImplTest, VariableDecorationList_ExtraComma) {
- auto p = parser(R"([[builtin position, ]])");
+ auto* p = parser(R"([[builtin position, ]])");
auto decos = p->variable_decoration_list();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:21: missing variable decoration after comma");
}
TEST_F(ParserImplTest, VariableDecorationList_MissingComma) {
- auto p = parser(R"([[binding 4 location 5]])");
+ auto* p = parser(R"([[binding 4 location 5]])");
auto decos = p->variable_decoration_list();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:13: missing comma in variable decoration list");
}
TEST_F(ParserImplTest, VariableDecorationList_BadDecoration) {
- auto p = parser(R"([[location bad]])");
+ auto* p = parser(R"([[location bad]])");
auto decos = p->variable_decoration_list();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:12: invalid value for location decoration");
}
TEST_F(ParserImplTest, VariableDecorationList_InvalidBuiltin) {
- auto p = parser("[[builtin invalid]]");
+ auto* p = parser("[[builtin invalid]]");
auto decos = p->variable_decoration_list();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:11: invalid value for builtin decoration");
diff --git a/src/reader/wgsl/parser_impl_variable_decoration_test.cc b/src/reader/wgsl/parser_impl_variable_decoration_test.cc
index 2a6a766..8c30a26 100644
--- a/src/reader/wgsl/parser_impl_variable_decoration_test.cc
+++ b/src/reader/wgsl/parser_impl_variable_decoration_test.cc
@@ -26,18 +26,18 @@
namespace {
TEST_F(ParserImplTest, VariableDecoration_Location) {
- auto p = parser("location 4");
+ auto* p = parser("location 4");
auto deco = p->variable_decoration();
ASSERT_NE(deco, nullptr);
ASSERT_FALSE(p->has_error());
ASSERT_TRUE(deco->IsLocation());
- auto loc = deco->AsLocation();
- EXPECT_EQ(loc->value(), 4);
+ auto* loc = deco->AsLocation();
+ EXPECT_EQ(loc->value(), 4u);
}
TEST_F(ParserImplTest, VariableDecoration_Location_MissingValue) {
- auto p = parser("location");
+ auto* p = parser("location");
auto deco = p->variable_decoration();
ASSERT_EQ(deco, nullptr);
ASSERT_TRUE(p->has_error());
@@ -45,7 +45,7 @@
}
TEST_F(ParserImplTest, VariableDecoration_Location_MissingInvalid) {
- auto p = parser("location nan");
+ auto* p = parser("location nan");
auto deco = p->variable_decoration();
ASSERT_EQ(deco, nullptr);
ASSERT_TRUE(p->has_error());
@@ -53,18 +53,18 @@
}
TEST_F(ParserImplTest, VariableDecoration_Builtin) {
- auto p = parser("builtin frag_depth");
+ auto* p = parser("builtin frag_depth");
auto deco = p->variable_decoration();
ASSERT_FALSE(p->has_error());
ASSERT_NE(deco, nullptr);
ASSERT_TRUE(deco->IsBuiltin());
- auto builtin = deco->AsBuiltin();
+ auto* builtin = deco->AsBuiltin();
EXPECT_EQ(builtin->value(), ast::Builtin::kFragDepth);
}
TEST_F(ParserImplTest, VariableDecoration_Builtin_MissingValue) {
- auto p = parser("builtin");
+ auto* p = parser("builtin");
auto deco = p->variable_decoration();
ASSERT_EQ(deco, nullptr);
ASSERT_TRUE(p->has_error());
@@ -72,7 +72,7 @@
}
TEST_F(ParserImplTest, VariableDecoration_Builtin_MissingInvalid) {
- auto p = parser("builtin 3");
+ auto* p = parser("builtin 3");
auto deco = p->variable_decoration();
ASSERT_EQ(deco, nullptr);
ASSERT_TRUE(p->has_error());
@@ -80,18 +80,18 @@
}
TEST_F(ParserImplTest, VariableDecoration_Binding) {
- auto p = parser("binding 4");
+ auto* p = parser("binding 4");
auto deco = p->variable_decoration();
ASSERT_NE(deco, nullptr);
ASSERT_FALSE(p->has_error());
ASSERT_TRUE(deco->IsBinding());
- auto binding = deco->AsBinding();
- EXPECT_EQ(binding->value(), 4);
+ auto* binding = deco->AsBinding();
+ EXPECT_EQ(binding->value(), 4u);
}
TEST_F(ParserImplTest, VariableDecoration_Binding_MissingValue) {
- auto p = parser("binding");
+ auto* p = parser("binding");
auto deco = p->variable_decoration();
ASSERT_EQ(deco, nullptr);
ASSERT_TRUE(p->has_error());
@@ -99,7 +99,7 @@
}
TEST_F(ParserImplTest, VariableDecoration_Binding_MissingInvalid) {
- auto p = parser("binding nan");
+ auto* p = parser("binding nan");
auto deco = p->variable_decoration();
ASSERT_EQ(deco, nullptr);
ASSERT_TRUE(p->has_error());
@@ -107,18 +107,18 @@
}
TEST_F(ParserImplTest, VariableDecoration_set) {
- auto p = parser("set 4");
+ auto* p = parser("set 4");
auto deco = p->variable_decoration();
ASSERT_FALSE(p->has_error());
ASSERT_NE(deco.get(), nullptr);
ASSERT_TRUE(deco->IsSet());
- auto set = deco->AsSet();
- EXPECT_EQ(set->value(), 4);
+ auto* set = deco->AsSet();
+ EXPECT_EQ(set->value(), 4u);
}
TEST_F(ParserImplTest, VariableDecoration_Set_MissingValue) {
- auto p = parser("set");
+ auto* p = parser("set");
auto deco = p->variable_decoration();
ASSERT_EQ(deco, nullptr);
ASSERT_TRUE(p->has_error());
@@ -126,7 +126,7 @@
}
TEST_F(ParserImplTest, VariableDecoration_Set_MissingInvalid) {
- auto p = parser("set nan");
+ auto* p = parser("set nan");
auto deco = p->variable_decoration();
ASSERT_EQ(deco, nullptr);
ASSERT_TRUE(p->has_error());
diff --git a/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc b/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc
index a9f0166..3a8b29f 100644
--- a/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc
@@ -22,7 +22,7 @@
namespace {
TEST_F(ParserImplTest, VariableIdentDecl_Parses) {
- auto p = parser("my_var : f32");
+ auto* p = parser("my_var : f32");
std::string name;
ast::type::Type* type;
std::tie(name, type) = p->variable_ident_decl();
@@ -33,7 +33,7 @@
}
TEST_F(ParserImplTest, VariableIdentDecl_MissingIdent) {
- auto p = parser(": f32");
+ auto* p = parser(": f32");
std::string name;
ast::type::Type* type;
std::tie(name, type) = p->variable_ident_decl();
@@ -46,21 +46,21 @@
}
TEST_F(ParserImplTest, VariableIdentDecl_MissingColon) {
- auto p = parser("my_var f32");
+ auto* p = parser("my_var f32");
auto r = p->variable_ident_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:8: missing : for identifier declaration");
}
TEST_F(ParserImplTest, VariableIdentDecl_MissingType) {
- auto p = parser("my_var :");
+ auto* p = parser("my_var :");
auto r = p->variable_ident_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:9: invalid type for identifier declaration");
}
TEST_F(ParserImplTest, VariableIdentDecl_InvalidIdent) {
- auto p = parser("123 : f32");
+ auto* p = parser("123 : f32");
std::string name;
ast::type::Type* type;
std::tie(name, type) = p->variable_ident_decl();
@@ -73,7 +73,7 @@
}
TEST_F(ParserImplTest, VariableIdentDecl_InvalidType) {
- auto p = parser("my_var : invalid");
+ auto* p = parser("my_var : invalid");
auto r = p->variable_ident_decl();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:10: unknown type alias 'invalid'");
diff --git a/src/reader/wgsl/parser_impl_variable_stmt_test.cc b/src/reader/wgsl/parser_impl_variable_stmt_test.cc
index 78b7685..891d572 100644
--- a/src/reader/wgsl/parser_impl_variable_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_variable_stmt_test.cc
@@ -24,7 +24,7 @@
namespace {
TEST_F(ParserImplTest, VariableStmt_VariableDecl) {
- auto p = parser("var a : i32;");
+ auto* p = parser("var a : i32;");
auto e = p->variable_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -36,7 +36,7 @@
}
TEST_F(ParserImplTest, VariableStmt_VariableDecl_WithInit) {
- auto p = parser("var a : i32 = 1;");
+ auto* p = parser("var a : i32 = 1;");
auto e = p->variable_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -49,7 +49,7 @@
}
TEST_F(ParserImplTest, VariableStmt_VariableDecl_Invalid) {
- auto p = parser("var a : invalid;");
+ auto* p = parser("var a : invalid;");
auto e = p->variable_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -57,7 +57,7 @@
}
TEST_F(ParserImplTest, VariableStmt_VariableDecl_ConstructorInvalid) {
- auto p = parser("var a : i32 = if(a) {}");
+ auto* p = parser("var a : i32 = if(a) {}");
auto e = p->variable_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -65,7 +65,7 @@
}
TEST_F(ParserImplTest, VariableStmt_Const) {
- auto p = parser("const a : i32 = 1");
+ auto* p = parser("const a : i32 = 1");
auto e = p->variable_stmt();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_NE(e, nullptr);
@@ -73,7 +73,7 @@
}
TEST_F(ParserImplTest, VariableStmt_Const_InvalidVarIdent) {
- auto p = parser("const a : invalid = 1");
+ auto* p = parser("const a : invalid = 1");
auto e = p->variable_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -81,7 +81,7 @@
}
TEST_F(ParserImplTest, VariableStmt_Const_MissingEqual) {
- auto p = parser("const a : i32 1");
+ auto* p = parser("const a : i32 1");
auto e = p->variable_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -89,7 +89,7 @@
}
TEST_F(ParserImplTest, VariableStmt_Const_MissingConstructor) {
- auto p = parser("const a : i32 =");
+ auto* p = parser("const a : i32 =");
auto e = p->variable_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
@@ -97,7 +97,7 @@
}
TEST_F(ParserImplTest, VariableStmt_Const_InvalidConstructor) {
- auto p = parser("const a : i32 = if (a) {}");
+ auto* p = parser("const a : i32 = if (a) {}");
auto e = p->variable_stmt();
ASSERT_TRUE(p->has_error());
ASSERT_EQ(e, nullptr);
diff --git a/src/reader/wgsl/parser_impl_variable_storage_decoration_test.cc b/src/reader/wgsl/parser_impl_variable_storage_decoration_test.cc
index 27a82f1..a15d211 100644
--- a/src/reader/wgsl/parser_impl_variable_storage_decoration_test.cc
+++ b/src/reader/wgsl/parser_impl_variable_storage_decoration_test.cc
@@ -36,9 +36,9 @@
VariableStorageTest() = default;
~VariableStorageTest() = default;
- void SetUp() { ctx_.Reset(); }
+ void SetUp() override { ctx_.Reset(); }
- void TearDown() { impl_ = nullptr; }
+ void TearDown() override { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@@ -52,7 +52,7 @@
TEST_P(VariableStorageTest, Parses) {
auto params = GetParam();
- auto p = parser(std::string("<") + params.input + ">");
+ auto* p = parser(std::string("<") + params.input + ">");
auto sc = p->variable_storage_decoration();
ASSERT_FALSE(p->has_error());
@@ -79,7 +79,7 @@
VariableStorageData{"function", ast::StorageClass::kFunction}));
TEST_F(ParserImplTest, VariableStorageDecoration_NoMatch) {
- auto p = parser("<not-a-storage-class>");
+ auto* p = parser("<not-a-storage-class>");
auto sc = p->variable_storage_decoration();
ASSERT_EQ(sc, ast::StorageClass::kNone);
ASSERT_TRUE(p->has_error());
@@ -87,7 +87,7 @@
}
TEST_F(ParserImplTest, VariableStorageDecoration_Empty) {
- auto p = parser("<>");
+ auto* p = parser("<>");
auto sc = p->variable_storage_decoration();
ASSERT_EQ(sc, ast::StorageClass::kNone);
ASSERT_TRUE(p->has_error());
@@ -95,7 +95,7 @@
}
TEST_F(ParserImplTest, VariableStorageDecoration_MissingLessThan) {
- auto p = parser("in>");
+ auto* p = parser("in>");
auto sc = p->variable_storage_decoration();
ASSERT_EQ(sc, ast::StorageClass::kNone);
ASSERT_FALSE(p->has_error());
@@ -105,7 +105,7 @@
}
TEST_F(ParserImplTest, VariableStorageDecoration_MissingGreaterThan) {
- auto p = parser("<in");
+ auto* p = parser("<in");
auto sc = p->variable_storage_decoration();
ASSERT_EQ(sc, ast::StorageClass::kNone);
ASSERT_TRUE(p->has_error());
diff --git a/src/reader/wgsl/parser_test.cc b/src/reader/wgsl/parser_test.cc
index 081deba..178794a 100644
--- a/src/reader/wgsl/parser_test.cc
+++ b/src/reader/wgsl/parser_test.cc
@@ -46,10 +46,10 @@
ASSERT_TRUE(p.Parse()) << p.error();
auto m = p.module();
- ASSERT_EQ(1, m.imports().size());
- ASSERT_EQ(1, m.entry_points().size());
- ASSERT_EQ(1, m.functions().size());
- ASSERT_EQ(1, m.global_variables().size());
+ ASSERT_EQ(1u, m.imports().size());
+ ASSERT_EQ(1u, m.entry_points().size());
+ ASSERT_EQ(1u, m.functions().size());
+ ASSERT_EQ(1u, m.global_variables().size());
}
TEST_F(ParserTest, HandlesError) {
diff --git a/src/reader/wgsl/token_test.cc b/src/reader/wgsl/token_test.cc
index c6dc9f5..4daa091 100644
--- a/src/reader/wgsl/token_test.cc
+++ b/src/reader/wgsl/token_test.cc
@@ -58,7 +58,7 @@
TEST_F(TokenTest, ReturnsU32) {
Token t2(Source{1, 1}, 2345u);
- EXPECT_EQ(t2.to_u32(), 2345);
+ EXPECT_EQ(t2.to_u32(), 2345u);
}
TEST_F(TokenTest, ReturnsMaxU32) {
@@ -68,8 +68,8 @@
TEST_F(TokenTest, Source) {
Token t(Token::Type::kUintLiteral, Source{3, 9});
- EXPECT_EQ(t.line(), 3);
- EXPECT_EQ(t.column(), 9);
+ EXPECT_EQ(t.line(), 3u);
+ EXPECT_EQ(t.column(), 9u);
}
} // namespace
diff --git a/src/scope_stack_test.cc b/src/scope_stack_test.cc
index 2f31292..f1f5551 100644
--- a/src/scope_stack_test.cc
+++ b/src/scope_stack_test.cc
@@ -27,7 +27,7 @@
uint32_t val = 0;
EXPECT_TRUE(s.get("var", &val));
- EXPECT_EQ(val, 5);
+ EXPECT_EQ(val, 5u);
}
TEST_F(ScopeStackTest, Global_SetWithPointer) {
@@ -49,7 +49,7 @@
uint32_t val = 0;
EXPECT_TRUE(s.get("var", &val));
- EXPECT_EQ(val, 5);
+ EXPECT_EQ(val, 5u);
}
TEST_F(ScopeStackTest, Scope) {
@@ -59,14 +59,14 @@
uint32_t val = 0;
EXPECT_TRUE(s.get("var", &val));
- EXPECT_EQ(val, 5);
+ EXPECT_EQ(val, 5u);
}
TEST_F(ScopeStackTest, Get_MissingName) {
ScopeStack<uint32_t> s;
uint32_t ret = 0;
EXPECT_FALSE(s.get("val", &ret));
- EXPECT_EQ(ret, 0);
+ EXPECT_EQ(ret, 0u);
}
TEST_F(ScopeStackTest, Has) {
@@ -87,7 +87,7 @@
uint32_t ret;
EXPECT_TRUE(s.get("var", &ret));
- EXPECT_EQ(ret, 5);
+ EXPECT_EQ(ret, 5u);
}
} // namespace
diff --git a/src/type_determiner_test.cc b/src/type_determiner_test.cc
index 875842a..b722511 100644
--- a/src/type_determiner_test.cc
+++ b/src/type_determiner_test.cc
@@ -1,4 +1,3 @@
-
// Copyright 2020 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -71,7 +70,7 @@
class TypeDeterminerTest : public testing::Test {
public:
- void SetUp() { td_ = std::make_unique<TypeDeterminer>(&ctx_); }
+ void SetUp() override { td_ = std::make_unique<TypeDeterminer>(&ctx_); }
TypeDeterminer* td() const { return td_.get(); }
@@ -103,11 +102,11 @@
auto lhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2));
- auto lhs_ptr = lhs.get();
+ auto* lhs_ptr = lhs.get();
auto rhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::FloatLiteral>(&f32, 2.3f));
- auto rhs_ptr = rhs.get();
+ auto* rhs_ptr = rhs.get();
ast::AssignmentStatement assign(std::move(lhs), std::move(rhs));
@@ -124,7 +123,7 @@
auto cond = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2));
- auto cond_ptr = cond.get();
+ auto* cond_ptr = cond.get();
ast::BreakStatement brk(ast::StatementCondition::kIf, std::move(cond));
@@ -145,11 +144,11 @@
auto lhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2));
- auto lhs_ptr = lhs.get();
+ auto* lhs_ptr = lhs.get();
auto rhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::FloatLiteral>(&f32, 2.3f));
- auto rhs_ptr = rhs.get();
+ auto* rhs_ptr = rhs.get();
ast::StatementList body;
body.push_back(std::make_unique<ast::AssignmentStatement>(std::move(lhs),
@@ -170,7 +169,7 @@
auto cond = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2));
- auto cond_ptr = cond.get();
+ auto* cond_ptr = cond.get();
ast::ContinueStatement stmt(ast::StatementCondition::kIf, std::move(cond));
@@ -191,11 +190,11 @@
auto lhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2));
- auto lhs_ptr = lhs.get();
+ auto* lhs_ptr = lhs.get();
auto rhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::FloatLiteral>(&f32, 2.3f));
- auto rhs_ptr = rhs.get();
+ auto* rhs_ptr = rhs.get();
ast::StatementList body;
body.push_back(std::make_unique<ast::AssignmentStatement>(std::move(lhs),
@@ -220,11 +219,11 @@
auto else_lhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2));
- auto else_lhs_ptr = else_lhs.get();
+ auto* else_lhs_ptr = else_lhs.get();
auto else_rhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::FloatLiteral>(&f32, 2.3f));
- auto else_rhs_ptr = else_rhs.get();
+ auto* else_rhs_ptr = else_rhs.get();
ast::StatementList else_body;
else_body.push_back(std::make_unique<ast::AssignmentStatement>(
@@ -240,11 +239,11 @@
auto lhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2));
- auto lhs_ptr = lhs.get();
+ auto* lhs_ptr = lhs.get();
auto rhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::FloatLiteral>(&f32, 2.3f));
- auto rhs_ptr = rhs.get();
+ auto* rhs_ptr = rhs.get();
ast::StatementList body;
body.push_back(std::make_unique<ast::AssignmentStatement>(std::move(lhs),
@@ -274,11 +273,11 @@
auto body_lhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2));
- auto body_lhs_ptr = body_lhs.get();
+ auto* body_lhs_ptr = body_lhs.get();
auto body_rhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::FloatLiteral>(&f32, 2.3f));
- auto body_rhs_ptr = body_rhs.get();
+ auto* body_rhs_ptr = body_rhs.get();
ast::StatementList body;
body.push_back(std::make_unique<ast::AssignmentStatement>(
@@ -286,11 +285,11 @@
auto continuing_lhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2));
- auto continuing_lhs_ptr = continuing_lhs.get();
+ auto* continuing_lhs_ptr = continuing_lhs.get();
auto continuing_rhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::FloatLiteral>(&f32, 2.3f));
- auto continuing_rhs_ptr = continuing_rhs.get();
+ auto* continuing_rhs_ptr = continuing_rhs.get();
ast::StatementList continuing;
continuing.push_back(std::make_unique<ast::AssignmentStatement>(
@@ -314,7 +313,7 @@
auto cond = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2));
- auto cond_ptr = cond.get();
+ auto* cond_ptr = cond.get();
ast::ReturnStatement ret(std::move(cond));
@@ -335,11 +334,11 @@
auto lhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2));
- auto lhs_ptr = lhs.get();
+ auto* lhs_ptr = lhs.get();
auto rhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::FloatLiteral>(&f32, 2.3f));
- auto rhs_ptr = rhs.get();
+ auto* rhs_ptr = rhs.get();
ast::StatementList body;
body.push_back(std::make_unique<ast::AssignmentStatement>(std::move(lhs),
@@ -369,11 +368,11 @@
auto lhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2));
- auto lhs_ptr = lhs.get();
+ auto* lhs_ptr = lhs.get();
auto rhs = std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::FloatLiteral>(&f32, 2.3f));
- auto rhs_ptr = rhs.get();
+ auto* rhs_ptr = rhs.get();
ast::StatementList body;
body.push_back(std::make_unique<ast::AssignmentStatement>(std::move(lhs),
@@ -399,7 +398,7 @@
std::make_unique<ast::Variable>("my_var", ast::StorageClass::kNone, &i32);
var->set_constructor(std::make_unique<ast::ScalarConstructorExpression>(
std::make_unique<ast::IntLiteral>(&i32, 2)));
- auto init_ptr = var->constructor();
+ auto* init_ptr = var->constructor();
ast::VariableDeclStatement decl(std::move(var));
@@ -460,7 +459,7 @@
EXPECT_TRUE(td()->DetermineResultType(&acc));
ASSERT_NE(acc.result_type(), nullptr);
ASSERT_TRUE(acc.result_type()->IsVector());
- EXPECT_EQ(acc.result_type()->AsVector()->size(), 3);
+ EXPECT_EQ(acc.result_type()->AsVector()->size(), 3u);
}
TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Matrix_BothDimensions) {
@@ -584,7 +583,7 @@
ASSERT_NE(tc.result_type(), nullptr);
ASSERT_TRUE(tc.result_type()->IsVector());
EXPECT_TRUE(tc.result_type()->AsVector()->type()->IsF32());
- EXPECT_EQ(tc.result_type()->AsVector()->size(), 3);
+ EXPECT_EQ(tc.result_type()->AsVector()->size(), 3u);
}
TEST_F(TypeDeterminerTest, Expr_Identifier_GlobalVariable) {
@@ -608,7 +607,7 @@
ast::type::F32Type f32;
auto my_var = std::make_unique<ast::IdentifierExpression>("my_var");
- auto my_var_ptr = my_var.get();
+ auto* my_var_ptr = my_var.get();
ast::StatementList body;
body.push_back(std::make_unique<ast::VariableDeclStatement>(
@@ -700,7 +699,7 @@
ASSERT_NE(mem.result_type(), nullptr);
ASSERT_TRUE(mem.result_type()->IsVector());
EXPECT_TRUE(mem.result_type()->AsVector()->type()->IsF32());
- EXPECT_EQ(mem.result_type()->AsVector()->size(), 2);
+ EXPECT_EQ(mem.result_type()->AsVector()->size(), 2u);
}
TEST_F(TypeDeterminerTest, Expr_MultiLevel) {
@@ -781,7 +780,7 @@
ASSERT_NE(mem.result_type(), nullptr);
ASSERT_TRUE(mem.result_type()->IsVector());
EXPECT_TRUE(mem.result_type()->AsVector()->type()->IsF32());
- EXPECT_EQ(mem.result_type()->AsVector()->size(), 2);
+ EXPECT_EQ(mem.result_type()->AsVector()->size(), 2u);
}
using Expr_Binary_BitwiseTest = testing::TestWithParam<ast::BinaryOp>;
@@ -837,7 +836,7 @@
ASSERT_NE(expr.result_type(), nullptr);
ASSERT_TRUE(expr.result_type()->IsVector());
EXPECT_TRUE(expr.result_type()->AsVector()->type()->IsI32());
- EXPECT_EQ(expr.result_type()->AsVector()->size(), 3);
+ EXPECT_EQ(expr.result_type()->AsVector()->size(), 3u);
}
INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
Expr_Binary_BitwiseTest,
@@ -905,7 +904,7 @@
ASSERT_NE(expr.result_type(), nullptr);
ASSERT_TRUE(expr.result_type()->IsVector());
EXPECT_TRUE(expr.result_type()->AsVector()->type()->IsBool());
- EXPECT_EQ(expr.result_type()->AsVector()->size(), 3);
+ EXPECT_EQ(expr.result_type()->AsVector()->size(), 3u);
}
INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
Expr_Binary_LogicalTest,
@@ -965,7 +964,7 @@
ASSERT_NE(expr.result_type(), nullptr);
ASSERT_TRUE(expr.result_type()->IsVector());
EXPECT_TRUE(expr.result_type()->AsVector()->type()->IsBool());
- EXPECT_EQ(expr.result_type()->AsVector()->size(), 3);
+ EXPECT_EQ(expr.result_type()->AsVector()->size(), 3u);
}
INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
Expr_Binary_CompareTest,
@@ -1029,7 +1028,7 @@
ASSERT_NE(expr.result_type(), nullptr);
ASSERT_TRUE(expr.result_type()->IsVector());
EXPECT_TRUE(expr.result_type()->AsVector()->type()->IsF32());
- EXPECT_EQ(expr.result_type()->AsVector()->size(), 3);
+ EXPECT_EQ(expr.result_type()->AsVector()->size(), 3u);
}
TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Scalar_Vector) {
@@ -1060,7 +1059,7 @@
ASSERT_NE(expr.result_type(), nullptr);
ASSERT_TRUE(expr.result_type()->IsVector());
EXPECT_TRUE(expr.result_type()->AsVector()->type()->IsF32());
- EXPECT_EQ(expr.result_type()->AsVector()->size(), 3);
+ EXPECT_EQ(expr.result_type()->AsVector()->size(), 3u);
}
TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Vector_Vector) {
@@ -1088,7 +1087,7 @@
ASSERT_NE(expr.result_type(), nullptr);
ASSERT_TRUE(expr.result_type()->IsVector());
EXPECT_TRUE(expr.result_type()->AsVector()->type()->IsF32());
- EXPECT_EQ(expr.result_type()->AsVector()->size(), 3);
+ EXPECT_EQ(expr.result_type()->AsVector()->size(), 3u);
}
TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Matrix_Scalar) {
@@ -1119,10 +1118,10 @@
ASSERT_NE(expr.result_type(), nullptr);
ASSERT_TRUE(expr.result_type()->IsMatrix());
- auto mat = expr.result_type()->AsMatrix();
+ auto* mat = expr.result_type()->AsMatrix();
EXPECT_TRUE(mat->type()->IsF32());
- EXPECT_EQ(mat->rows(), 3);
- EXPECT_EQ(mat->columns(), 2);
+ EXPECT_EQ(mat->rows(), 3u);
+ EXPECT_EQ(mat->columns(), 2u);
}
TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Scalar_Matrix) {
@@ -1153,10 +1152,10 @@
ASSERT_NE(expr.result_type(), nullptr);
ASSERT_TRUE(expr.result_type()->IsMatrix());
- auto mat = expr.result_type()->AsMatrix();
+ auto* mat = expr.result_type()->AsMatrix();
EXPECT_TRUE(mat->type()->IsF32());
- EXPECT_EQ(mat->rows(), 3);
- EXPECT_EQ(mat->columns(), 2);
+ EXPECT_EQ(mat->rows(), 3u);
+ EXPECT_EQ(mat->columns(), 2u);
}
TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Matrix_Vector) {
@@ -1188,7 +1187,7 @@
ASSERT_NE(expr.result_type(), nullptr);
ASSERT_TRUE(expr.result_type()->IsVector());
EXPECT_TRUE(expr.result_type()->AsVector()->type()->IsF32());
- EXPECT_EQ(expr.result_type()->AsVector()->size(), 3);
+ EXPECT_EQ(expr.result_type()->AsVector()->size(), 3u);
}
TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Vector_Matrix) {
@@ -1220,7 +1219,7 @@
ASSERT_NE(expr.result_type(), nullptr);
ASSERT_TRUE(expr.result_type()->IsVector());
EXPECT_TRUE(expr.result_type()->AsVector()->type()->IsF32());
- EXPECT_EQ(expr.result_type()->AsVector()->size(), 2);
+ EXPECT_EQ(expr.result_type()->AsVector()->size(), 2u);
}
TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Matrix_Matrix) {
@@ -1252,10 +1251,10 @@
ASSERT_NE(expr.result_type(), nullptr);
ASSERT_TRUE(expr.result_type()->IsMatrix());
- auto mat = expr.result_type()->AsMatrix();
+ auto* mat = expr.result_type()->AsMatrix();
EXPECT_TRUE(mat->type()->IsF32());
- EXPECT_EQ(mat->rows(), 4);
- EXPECT_EQ(mat->columns(), 4);
+ EXPECT_EQ(mat->rows(), 4u);
+ EXPECT_EQ(mat->columns(), 4u);
}
using UnaryDerivativeExpressionTest =
@@ -1286,7 +1285,7 @@
ASSERT_NE(der.result_type(), nullptr);
ASSERT_TRUE(der.result_type()->IsVector());
EXPECT_TRUE(der.result_type()->AsVector()->type()->IsF32());
- EXPECT_EQ(der.result_type()->AsVector()->size(), 4);
+ EXPECT_EQ(der.result_type()->AsVector()->size(), 4u);
}
INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
UnaryDerivativeExpressionTest,
@@ -1355,7 +1354,7 @@
ASSERT_NE(exp.result_type(), nullptr);
ASSERT_TRUE(exp.result_type()->IsVector());
EXPECT_TRUE(exp.result_type()->AsVector()->type()->IsBool());
- EXPECT_EQ(exp.result_type()->AsVector()->size(), 3);
+ EXPECT_EQ(exp.result_type()->AsVector()->size(), 3u);
}
TEST_P(UnaryMethodExpressionVecTest, Expr_UnaryMethod_Vec) {
auto op = GetParam();
@@ -1447,10 +1446,10 @@
EXPECT_TRUE(td.DetermineResultType(&exp));
ASSERT_NE(exp.result_type(), nullptr);
ASSERT_TRUE(exp.result_type()->IsMatrix());
- auto mat = exp.result_type()->AsMatrix();
+ auto* mat = exp.result_type()->AsMatrix();
EXPECT_TRUE(mat->type()->IsF32());
- EXPECT_EQ(mat->rows(), 3);
- EXPECT_EQ(mat->columns(), 2);
+ EXPECT_EQ(mat->rows(), 3u);
+ EXPECT_EQ(mat->columns(), 2u);
}
using UnaryOpExpressionTest = testing::TestWithParam<ast::UnaryOp>;
@@ -1479,7 +1478,7 @@
ASSERT_NE(der.result_type(), nullptr);
ASSERT_TRUE(der.result_type()->IsVector());
EXPECT_TRUE(der.result_type()->AsVector()->type()->IsF32());
- EXPECT_EQ(der.result_type()->AsVector()->size(), 4);
+ EXPECT_EQ(der.result_type()->AsVector()->size(), 4u);
}
INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
UnaryOpExpressionTest,
@@ -1491,7 +1490,7 @@
auto var =
std::make_unique<ast::Variable>("var", ast::StorageClass::kNone, &i32);
- auto var_ptr = var.get();
+ auto* var_ptr = var.get();
auto stmt = std::make_unique<ast::VariableDeclStatement>(std::move(var));
auto func =
@@ -1513,7 +1512,7 @@
auto var =
std::make_unique<ast::Variable>("var", ast::StorageClass::kNone, &i32);
var->set_is_const(true);
- auto var_ptr = var.get();
+ auto* var_ptr = var.get();
auto stmt = std::make_unique<ast::VariableDeclStatement>(std::move(var));
auto func =
diff --git a/src/type_manager_test.cc b/src/type_manager_test.cc
index a0526d1..1628ffb 100644
--- a/src/type_manager_test.cc
+++ b/src/type_manager_test.cc
@@ -25,28 +25,28 @@
TEST_F(TypeManagerTest, GetUnregistered) {
TypeManager tm;
- auto t = tm.Get(std::make_unique<ast::type::I32Type>());
+ auto* t = tm.Get(std::make_unique<ast::type::I32Type>());
ASSERT_NE(t, nullptr);
EXPECT_TRUE(t->IsI32());
}
TEST_F(TypeManagerTest, GetSameTypeReturnsSamePtr) {
TypeManager tm;
- auto t = tm.Get(std::make_unique<ast::type::I32Type>());
+ auto* t = tm.Get(std::make_unique<ast::type::I32Type>());
ASSERT_NE(t, nullptr);
EXPECT_TRUE(t->IsI32());
- auto t2 = tm.Get(std::make_unique<ast::type::I32Type>());
+ auto* t2 = tm.Get(std::make_unique<ast::type::I32Type>());
EXPECT_EQ(t, t2);
}
TEST_F(TypeManagerTest, GetDifferentTypeReturnsDifferentPtr) {
TypeManager tm;
- auto t = tm.Get(std::make_unique<ast::type::I32Type>());
+ auto* t = tm.Get(std::make_unique<ast::type::I32Type>());
ASSERT_NE(t, nullptr);
EXPECT_TRUE(t->IsI32());
- auto t2 = tm.Get(std::make_unique<ast::type::U32Type>());
+ auto* t2 = tm.Get(std::make_unique<ast::type::U32Type>());
ASSERT_NE(t2, nullptr);
EXPECT_NE(t, t2);
EXPECT_TRUE(t2->IsU32());
@@ -54,14 +54,14 @@
TEST_F(TypeManagerTest, ResetClearsPreviousData) {
TypeManager tm;
- auto t = tm.Get(std::make_unique<ast::type::I32Type>());
+ auto* t = tm.Get(std::make_unique<ast::type::I32Type>());
ASSERT_NE(t, nullptr);
EXPECT_FALSE(tm.TypesForTesting().empty());
tm.Reset();
EXPECT_TRUE(tm.TypesForTesting().empty());
- auto t2 = tm.Get(std::make_unique<ast::type::I32Type>());
+ auto* t2 = tm.Get(std::make_unique<ast::type::I32Type>());
ASSERT_NE(t2, nullptr);
}
diff --git a/src/writer/spirv/binary_writer_test.cc b/src/writer/spirv/binary_writer_test.cc
index 2a574c4..f3cf327 100644
--- a/src/writer/spirv/binary_writer_test.cc
+++ b/src/writer/spirv/binary_writer_test.cc
@@ -33,12 +33,12 @@
bw.WriteHeader(5);
auto res = bw.result();
- ASSERT_EQ(res.size(), 5);
+ ASSERT_EQ(res.size(), 5u);
EXPECT_EQ(res[0], spv::MagicNumber);
- EXPECT_EQ(res[1], 0x00010300); // SPIR-V 1.3
- EXPECT_EQ(res[2], 0); // Generator ID
- EXPECT_EQ(res[3], 5); // ID Bound
- EXPECT_EQ(res[4], 0); // Reserved
+ EXPECT_EQ(res[1], 0x00010300u); // SPIR-V 1.3
+ EXPECT_EQ(res[2], 0u); // Generator ID
+ EXPECT_EQ(res[3], 5u); // ID Bound
+ EXPECT_EQ(res[4], 0u); // Reserved
}
TEST_F(BinaryWriterTest, Float) {
@@ -48,7 +48,7 @@
bw.WriteBuilder(b);
auto res = bw.result();
- ASSERT_EQ(res.size(), 2);
+ ASSERT_EQ(res.size(), 2u);
float f;
memcpy(&f, res.data() + 1, 4);
EXPECT_EQ(f, 2.4f);
@@ -61,8 +61,8 @@
bw.WriteBuilder(b);
auto res = bw.result();
- ASSERT_EQ(res.size(), 2);
- EXPECT_EQ(res[1], 2);
+ ASSERT_EQ(res.size(), 2u);
+ EXPECT_EQ(res[1], 2u);
}
TEST_F(BinaryWriterTest, String) {
@@ -72,7 +72,7 @@
bw.WriteBuilder(b);
auto res = bw.result();
- ASSERT_EQ(res.size(), 4);
+ ASSERT_EQ(res.size(), 4u);
uint8_t* v = reinterpret_cast<uint8_t*>(res.data() + 1);
EXPECT_EQ(v[0], 'm');
@@ -96,7 +96,7 @@
bw.WriteBuilder(b);
auto res = bw.result();
- ASSERT_EQ(res.size(), 4);
+ ASSERT_EQ(res.size(), 4u);
uint8_t* v = reinterpret_cast<uint8_t*>(res.data() + 1);
EXPECT_EQ(v[0], 'm');
@@ -122,9 +122,9 @@
bw.WriteInstruction(i2);
auto res = bw.result();
- ASSERT_EQ(res.size(), 4);
- EXPECT_EQ(res[1], 2);
- EXPECT_EQ(res[3], 4);
+ ASSERT_EQ(res.size(), 4u);
+ EXPECT_EQ(res[1], 2u);
+ EXPECT_EQ(res[3], 4u);
}
} // namespace
diff --git a/src/writer/spirv/builder_binary_expression_test.cc b/src/writer/spirv/builder_binary_expression_test.cc
index fe18196..e356454 100644
--- a/src/writer/spirv/builder_binary_expression_test.cc
+++ b/src/writer/spirv/builder_binary_expression_test.cc
@@ -67,7 +67,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 4) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 4u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1
%2 = OpConstant %1 3
%3 = OpConstant %1 4
@@ -110,7 +110,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 1
%1 = OpTypeVector %2 3
%3 = OpConstant %2 1
@@ -155,7 +155,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 4) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 4u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 0
%2 = OpConstant %1 3
%3 = OpConstant %1 4
@@ -198,7 +198,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 0
%1 = OpTypeVector %2 3
%3 = OpConstant %2 1
@@ -243,7 +243,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 4) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 4u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32
%2 = OpConstant %1 3.20000005
%3 = OpConstant %1 4.5
@@ -287,7 +287,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 3
%3 = OpConstant %2 1
@@ -325,7 +325,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 4) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 4u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 0
%2 = OpConstant %1 3
%3 = OpConstant %1 4
@@ -370,7 +370,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 0
%1 = OpTypeVector %2 3
%3 = OpConstant %2 1
@@ -412,7 +412,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 4) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 4u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1
%2 = OpConstant %1 3
%3 = OpConstant %1 4
@@ -457,7 +457,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 1
%1 = OpTypeVector %2 3
%3 = OpConstant %2 1
@@ -499,7 +499,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 4) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 4u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32
%2 = OpConstant %1 3.20000005
%3 = OpConstant %1 4.5
@@ -544,7 +544,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 3
%3 = OpConstant %2 1
@@ -594,7 +594,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 3
%3 = OpConstant %2 1
@@ -632,7 +632,7 @@
Builder b;
b.push_function(Function{});
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 5u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32
%2 = OpConstant %1 1
%3 = OpTypeVector %1 3
@@ -665,7 +665,7 @@
b.push_function(Function{});
ASSERT_TRUE(b.GenerateGlobalVariable(var.get())) << b.error();
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 8) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 8u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeFloat 32
%4 = OpTypeVector %5 3
%3 = OpTypeMatrix %4 3
@@ -702,7 +702,7 @@
b.push_function(Function{});
ASSERT_TRUE(b.GenerateGlobalVariable(var.get())) << b.error();
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 8) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 8u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeFloat 32
%4 = OpTypeVector %5 3
%3 = OpTypeMatrix %4 3
@@ -748,7 +748,7 @@
b.push_function(Function{});
ASSERT_TRUE(b.GenerateGlobalVariable(var.get())) << b.error();
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 9) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 9u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeFloat 32
%4 = OpTypeVector %5 3
%3 = OpTypeMatrix %4 3
@@ -796,7 +796,7 @@
b.push_function(Function{});
ASSERT_TRUE(b.GenerateGlobalVariable(var.get())) << b.error();
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 9) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 9u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeFloat 32
%4 = OpTypeVector %5 3
%3 = OpTypeMatrix %4 3
@@ -834,7 +834,7 @@
b.push_function(Function{});
ASSERT_TRUE(b.GenerateGlobalVariable(var.get())) << b.error();
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 8) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 8u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeFloat 32
%4 = OpTypeVector %5 3
%3 = OpTypeMatrix %4 3
diff --git a/src/writer/spirv/builder_constructor_expression_test.cc b/src/writer/spirv/builder_constructor_expression_test.cc
index 49cb27d..5e8f462 100644
--- a/src/writer/spirv/builder_constructor_expression_test.cc
+++ b/src/writer/spirv/builder_constructor_expression_test.cc
@@ -39,7 +39,7 @@
ast::ScalarConstructorExpression c(std::move(fl));
Builder b;
- EXPECT_EQ(b.GenerateConstructorExpression(&c, true), 2);
+ EXPECT_EQ(b.GenerateConstructorExpression(&c, true), 2u);
ASSERT_FALSE(b.has_error()) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32
@@ -62,7 +62,7 @@
ast::TypeConstructorExpression t(&vec, std::move(vals));
Builder b;
- EXPECT_EQ(b.GenerateConstructorExpression(&t, true), 5);
+ EXPECT_EQ(b.GenerateConstructorExpression(&t, true), 5u);
ASSERT_FALSE(b.has_error()) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
@@ -88,8 +88,8 @@
ast::TypeConstructorExpression t(&vec, std::move(vals));
Builder b;
- EXPECT_EQ(b.GenerateConstructorExpression(&t, true), 5);
- EXPECT_EQ(b.GenerateConstructorExpression(&t, true), 5);
+ EXPECT_EQ(b.GenerateConstructorExpression(&t, true), 5u);
+ EXPECT_EQ(b.GenerateConstructorExpression(&t, true), 5u);
ASSERT_FALSE(b.has_error()) << b.error();
}
@@ -111,7 +111,7 @@
ast::TypeConstructorExpression t(&vec, std::move(vals));
Builder b;
- EXPECT_EQ(b.GenerateConstructorExpression(&t, true), 0);
+ EXPECT_EQ(b.GenerateConstructorExpression(&t, true), 0u);
EXPECT_TRUE(b.has_error());
EXPECT_EQ(b.error(), R"(constructor must be a constant expression)");
}
diff --git a/src/writer/spirv/builder_entry_point_test.cc b/src/writer/spirv/builder_entry_point_test.cc
index c92df6f..d629d26 100644
--- a/src/writer/spirv/builder_entry_point_test.cc
+++ b/src/writer/spirv/builder_entry_point_test.cc
@@ -37,7 +37,7 @@
ASSERT_TRUE(b.GenerateEntryPoint(&ep));
auto preamble = b.preamble();
- ASSERT_EQ(preamble.size(), 1);
+ ASSERT_EQ(preamble.size(), 1u);
EXPECT_EQ(DumpInstruction(preamble[0]), R"(OpEntryPoint Fragment %2 "main"
)");
}
@@ -50,7 +50,7 @@
ASSERT_TRUE(b.GenerateEntryPoint(&ep));
auto preamble = b.preamble();
- ASSERT_EQ(preamble.size(), 1);
+ ASSERT_EQ(preamble.size(), 1u);
EXPECT_EQ(DumpInstruction(preamble[0]),
R"(OpEntryPoint GLCompute %3 "compute_main"
)");
@@ -83,10 +83,10 @@
ASSERT_TRUE(b.GenerateEntryPoint(&ep));
auto preamble = b.preamble();
- ASSERT_EQ(preamble.size(), 1);
+ ASSERT_EQ(preamble.size(), 1u);
EXPECT_EQ(preamble[0].opcode(), spv::Op::OpEntryPoint);
- ASSERT_GE(preamble[0].operands().size(), 3);
+ ASSERT_GE(preamble[0].operands().size(), 3u);
EXPECT_EQ(preamble[0].operands()[0].to_i(), params.model);
}
INSTANTIATE_TEST_SUITE_P(
diff --git a/src/writer/spirv/builder_function_test.cc b/src/writer/spirv/builder_function_test.cc
index d5ee73e..f250cfb 100644
--- a/src/writer/spirv/builder_function_test.cc
+++ b/src/writer/spirv/builder_function_test.cc
@@ -42,7 +42,7 @@
%1 = OpTypeFunction %2
)");
- ASSERT_GE(b.functions().size(), 1);
+ ASSERT_GE(b.functions().size(), 1u);
const auto& ret = b.functions()[0];
EXPECT_EQ(DumpInstruction(ret.declaration()), R"(%3 = OpFunction %2 None %1
)");
diff --git a/src/writer/spirv/builder_ident_expression_test.cc b/src/writer/spirv/builder_ident_expression_test.cc
index 699de11..785aef5 100644
--- a/src/writer/spirv/builder_ident_expression_test.cc
+++ b/src/writer/spirv/builder_ident_expression_test.cc
@@ -68,7 +68,7 @@
)");
ast::IdentifierExpression expr("var");
- EXPECT_EQ(b.GenerateIdentifierExpression(&expr), 5);
+ EXPECT_EQ(b.GenerateIdentifierExpression(&expr), 5u);
}
TEST_F(BuilderTest, IdentifierExpression_GlobalVar) {
@@ -85,7 +85,7 @@
)");
ast::IdentifierExpression expr("var");
- EXPECT_EQ(b.GenerateIdentifierExpression(&expr), 1);
+ EXPECT_EQ(b.GenerateIdentifierExpression(&expr), 1u);
}
TEST_F(BuilderTest, IdentifierExpression_FunctionConst) {
@@ -119,7 +119,7 @@
)");
ast::IdentifierExpression expr("var");
- EXPECT_EQ(b.GenerateIdentifierExpression(&expr), 5);
+ EXPECT_EQ(b.GenerateIdentifierExpression(&expr), 5u);
}
TEST_F(BuilderTest, IdentifierExpression_FunctionVar) {
@@ -140,7 +140,7 @@
)");
ast::IdentifierExpression expr("var");
- EXPECT_EQ(b.GenerateIdentifierExpression(&expr), 1);
+ EXPECT_EQ(b.GenerateIdentifierExpression(&expr), 1u);
}
TEST_F(BuilderTest, IdentifierExpression_Load) {
@@ -165,7 +165,7 @@
b.push_function(Function{});
ASSERT_TRUE(b.GenerateGlobalVariable(&var)) << b.error();
- ASSERT_EQ(b.GenerateBinaryExpression(&expr), 6) << b.error();
+ ASSERT_EQ(b.GenerateBinaryExpression(&expr), 6u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeInt 32 1
%2 = OpTypePointer Private %3
%1 = OpVariable %2 Private
@@ -202,7 +202,7 @@
b.push_function(Function{});
ASSERT_TRUE(b.GenerateGlobalVariable(&var)) << b.error();
- EXPECT_EQ(b.GenerateBinaryExpression(&expr), 3) << b.error();
+ EXPECT_EQ(b.GenerateBinaryExpression(&expr), 3u) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1
%2 = OpConstant %1 2
)");
diff --git a/src/writer/spirv/builder_literal_test.cc b/src/writer/spirv/builder_literal_test.cc
index 3fdda3b..d87e9b1 100644
--- a/src/writer/spirv/builder_literal_test.cc
+++ b/src/writer/spirv/builder_literal_test.cc
@@ -39,7 +39,7 @@
Builder b;
auto id = b.GenerateLiteralIfNeeded(&b_true);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(2, id);
+ EXPECT_EQ(2u, id);
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeBool
%2 = OpConstantTrue %1
@@ -53,7 +53,7 @@
Builder b;
auto id = b.GenerateLiteralIfNeeded(&b_false);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(2, id);
+ EXPECT_EQ(2u, id);
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeBool
%2 = OpConstantFalse %1
@@ -66,11 +66,11 @@
ast::BoolLiteral b_false(&bool_type, false);
Builder b;
- ASSERT_NE(b.GenerateLiteralIfNeeded(&b_true), 0);
+ ASSERT_NE(b.GenerateLiteralIfNeeded(&b_true), 0u);
ASSERT_FALSE(b.has_error()) << b.error();
- ASSERT_NE(b.GenerateLiteralIfNeeded(&b_false), 0);
+ ASSERT_NE(b.GenerateLiteralIfNeeded(&b_false), 0u);
ASSERT_FALSE(b.has_error()) << b.error();
- ASSERT_NE(b.GenerateLiteralIfNeeded(&b_true), 0);
+ ASSERT_NE(b.GenerateLiteralIfNeeded(&b_true), 0u);
ASSERT_FALSE(b.has_error()) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeBool
@@ -86,7 +86,7 @@
Builder b;
auto id = b.GenerateLiteralIfNeeded(&i);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(2, id);
+ EXPECT_EQ(2u, id);
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1
%2 = OpConstant %1 -23
@@ -99,8 +99,8 @@
ast::IntLiteral i2(&i32, -23);
Builder b;
- ASSERT_NE(b.GenerateLiteralIfNeeded(&i1), 0);
- ASSERT_NE(b.GenerateLiteralIfNeeded(&i2), 0);
+ ASSERT_NE(b.GenerateLiteralIfNeeded(&i1), 0u);
+ ASSERT_NE(b.GenerateLiteralIfNeeded(&i2), 0u);
ASSERT_FALSE(b.has_error()) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1
@@ -115,7 +115,7 @@
Builder b;
auto id = b.GenerateLiteralIfNeeded(&i);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(2, id);
+ EXPECT_EQ(2u, id);
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 0
%2 = OpConstant %1 23
@@ -128,8 +128,8 @@
ast::UintLiteral i2(&u32, 23);
Builder b;
- ASSERT_NE(b.GenerateLiteralIfNeeded(&i1), 0);
- ASSERT_NE(b.GenerateLiteralIfNeeded(&i2), 0);
+ ASSERT_NE(b.GenerateLiteralIfNeeded(&i1), 0u);
+ ASSERT_NE(b.GenerateLiteralIfNeeded(&i2), 0u);
ASSERT_FALSE(b.has_error()) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 0
@@ -144,7 +144,7 @@
Builder b;
auto id = b.GenerateLiteralIfNeeded(&i);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(2, id);
+ EXPECT_EQ(2u, id);
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32
%2 = OpConstant %1 23.2450008
@@ -157,8 +157,8 @@
ast::FloatLiteral i2(&f32, 23.245f);
Builder b;
- ASSERT_NE(b.GenerateLiteralIfNeeded(&i1), 0);
- ASSERT_NE(b.GenerateLiteralIfNeeded(&i2), 0);
+ ASSERT_NE(b.GenerateLiteralIfNeeded(&i1), 0u);
+ ASSERT_NE(b.GenerateLiteralIfNeeded(&i2), 0u);
ASSERT_FALSE(b.has_error()) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32
diff --git a/src/writer/spirv/builder_test.cc b/src/writer/spirv/builder_test.cc
index de6fd7a..6360d72 100644
--- a/src/writer/spirv/builder_test.cc
+++ b/src/writer/spirv/builder_test.cc
@@ -36,7 +36,7 @@
Builder b;
ASSERT_TRUE(b.Build(m));
- ASSERT_EQ(b.preamble().size(), 4);
+ ASSERT_EQ(b.preamble().size(), 4u);
EXPECT_EQ(DumpBuilder(b), R"(OpCapability Shader
OpCapability VulkanMemoryModel
@@ -62,7 +62,7 @@
EXPECT_EQ(b.next_id(), i + 1);
}
- EXPECT_EQ(6, b.id_bound());
+ EXPECT_EQ(6u, b.id_bound());
}
} // namespace
diff --git a/src/writer/spirv/builder_type_test.cc b/src/writer/spirv/builder_type_test.cc
index 765c24b..1e2c79b 100644
--- a/src/writer/spirv/builder_type_test.cc
+++ b/src/writer/spirv/builder_type_test.cc
@@ -46,9 +46,9 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&alias_type);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(id, 1);
+ EXPECT_EQ(id, 1u);
- EXPECT_EQ(b.types().size(), 1);
+ EXPECT_EQ(b.types().size(), 1u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32
)");
}
@@ -59,13 +59,13 @@
ast::type::AliasType alias_type("my_type", &f32);
Builder b;
- EXPECT_EQ(b.GenerateTypeIfNeeded(&alias_type), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&alias_type), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 2);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 2u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&alias_type), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&alias_type), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&f32), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&f32), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
}
@@ -76,7 +76,7 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&ary);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(1, id);
+ EXPECT_EQ(1u, id);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 1
%1 = OpTypeRuntimeArray %2
@@ -88,8 +88,8 @@
ast::type::ArrayType ary(&i32);
Builder b;
- EXPECT_EQ(b.GenerateTypeIfNeeded(&ary), 1);
- EXPECT_EQ(b.GenerateTypeIfNeeded(&ary), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&ary), 1u);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&ary), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 1
@@ -104,7 +104,7 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&ary);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(1, id);
+ EXPECT_EQ(1u, id);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 1
%3 = OpTypeInt 32 0
@@ -118,8 +118,8 @@
ast::type::ArrayType ary(&i32, 4);
Builder b;
- EXPECT_EQ(b.GenerateTypeIfNeeded(&ary), 1);
- EXPECT_EQ(b.GenerateTypeIfNeeded(&ary), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&ary), 1u);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&ary), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 1
@@ -135,9 +135,9 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&bool_type);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(id, 1);
+ EXPECT_EQ(id, 1u);
- ASSERT_EQ(b.types().size(), 1);
+ ASSERT_EQ(b.types().size(), 1u);
EXPECT_EQ(DumpInstruction(b.types()[0]), R"(%1 = OpTypeBool
)");
}
@@ -147,11 +147,11 @@
ast::type::BoolType bool_type;
Builder b;
- EXPECT_EQ(b.GenerateTypeIfNeeded(&bool_type), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&bool_type), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 2);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 2u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&bool_type), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&bool_type), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
}
@@ -161,9 +161,9 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&f32);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(id, 1);
+ EXPECT_EQ(id, 1u);
- ASSERT_EQ(b.types().size(), 1);
+ ASSERT_EQ(b.types().size(), 1u);
EXPECT_EQ(DumpInstruction(b.types()[0]), R"(%1 = OpTypeFloat 32
)");
}
@@ -173,11 +173,11 @@
ast::type::F32Type f32;
Builder b;
- EXPECT_EQ(b.GenerateTypeIfNeeded(&f32), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&f32), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 2);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 2u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&f32), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&f32), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
}
@@ -187,9 +187,9 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&i32);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(id, 1);
+ EXPECT_EQ(id, 1u);
- ASSERT_EQ(b.types().size(), 1);
+ ASSERT_EQ(b.types().size(), 1u);
EXPECT_EQ(DumpInstruction(b.types()[0]), R"(%1 = OpTypeInt 32 1
)");
}
@@ -199,11 +199,11 @@
ast::type::F32Type f32;
Builder b;
- EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&f32), 2);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&f32), 2u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
}
@@ -214,9 +214,9 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&mat_type);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(id, 1);
+ EXPECT_EQ(id, 1u);
- EXPECT_EQ(b.types().size(), 3);
+ EXPECT_EQ(b.types().size(), 3u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 32
%2 = OpTypeVector %3 3
%1 = OpTypeMatrix %2 2
@@ -228,11 +228,11 @@
ast::type::MatrixType mat_type(&i32, 3, 4);
Builder b;
- EXPECT_EQ(b.GenerateTypeIfNeeded(&mat_type), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&mat_type), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 3);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 3u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&mat_type), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&mat_type), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
}
@@ -243,7 +243,7 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&ptr);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(1, id);
+ EXPECT_EQ(1u, id);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 1
%1 = OpTypePointer Output %2
@@ -255,8 +255,8 @@
ast::type::PointerType ptr(&i32, ast::StorageClass::kOutput);
Builder b;
- EXPECT_EQ(b.GenerateTypeIfNeeded(&ptr), 1);
- EXPECT_EQ(b.GenerateTypeIfNeeded(&ptr), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&ptr), 1u);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&ptr), 1u);
}
TEST_F(BuilderTest_Type, GenerateStruct_Empty) {
@@ -266,9 +266,9 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&s_type);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(id, 1);
+ EXPECT_EQ(id, 1u);
- EXPECT_EQ(b.types().size(), 1);
+ EXPECT_EQ(b.types().size(), 1u);
EXPECT_EQ(DumpInstructions(b.debug()), "");
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeStruct
)");
@@ -290,7 +290,7 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&s_type);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(id, 1);
+ EXPECT_EQ(id, 1u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeStruct %2
@@ -316,7 +316,7 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&s_type);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(id, 1);
+ EXPECT_EQ(id, 1u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeStruct %2
@@ -349,7 +349,7 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&s_type);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(id, 1);
+ EXPECT_EQ(id, 1u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeStruct %2 %2
@@ -368,9 +368,9 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&u32);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(id, 1);
+ EXPECT_EQ(id, 1u);
- ASSERT_EQ(b.types().size(), 1);
+ ASSERT_EQ(b.types().size(), 1u);
EXPECT_EQ(DumpInstruction(b.types()[0]), R"(%1 = OpTypeInt 32 0
)");
}
@@ -380,11 +380,11 @@
ast::type::F32Type f32;
Builder b;
- EXPECT_EQ(b.GenerateTypeIfNeeded(&u32), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&u32), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&f32), 2);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&f32), 2u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&u32), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&u32), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
}
@@ -395,9 +395,9 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&vec_type);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(id, 1);
+ EXPECT_EQ(id, 1u);
- EXPECT_EQ(b.types().size(), 2);
+ EXPECT_EQ(b.types().size(), 2u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 3
)");
@@ -408,11 +408,11 @@
ast::type::VectorType vec_type(&i32, 3);
Builder b;
- EXPECT_EQ(b.GenerateTypeIfNeeded(&vec_type), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&vec_type), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 2);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 2u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&vec_type), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&vec_type), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
}
@@ -422,9 +422,9 @@
Builder b;
auto id = b.GenerateTypeIfNeeded(&void_type);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(id, 1);
+ EXPECT_EQ(id, 1u);
- ASSERT_EQ(b.types().size(), 1);
+ ASSERT_EQ(b.types().size(), 1u);
EXPECT_EQ(DumpInstruction(b.types()[0]), R"(%1 = OpTypeVoid
)");
}
@@ -434,11 +434,11 @@
ast::type::VoidType void_type;
Builder b;
- EXPECT_EQ(b.GenerateTypeIfNeeded(&void_type), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&void_type), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 2);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&i32), 2u);
ASSERT_FALSE(b.has_error()) << b.error();
- EXPECT_EQ(b.GenerateTypeIfNeeded(&void_type), 1);
+ EXPECT_EQ(b.GenerateTypeIfNeeded(&void_type), 1u);
ASSERT_FALSE(b.has_error()) << b.error();
}
diff --git a/src/writer/spirv/instruction_test.cc b/src/writer/spirv/instruction_test.cc
index e147a41..65e0630 100644
--- a/src/writer/spirv/instruction_test.cc
+++ b/src/writer/spirv/instruction_test.cc
@@ -28,14 +28,14 @@
Instruction i(spv::Op::OpEntryPoint, {Operand::Float(1.2f), Operand::Int(1),
Operand::String("my_str")});
EXPECT_EQ(i.opcode(), spv::Op::OpEntryPoint);
- ASSERT_EQ(i.operands().size(), 3);
+ ASSERT_EQ(i.operands().size(), 3u);
const auto& ops = i.operands();
EXPECT_TRUE(ops[0].IsFloat());
EXPECT_FLOAT_EQ(ops[0].to_f(), 1.2);
EXPECT_TRUE(ops[1].IsInt());
- EXPECT_EQ(ops[1].to_i(), 1);
+ EXPECT_EQ(ops[1].to_i(), 1u);
EXPECT_TRUE(ops[2].IsString());
EXPECT_EQ(ops[2].to_s(), "my_str");
@@ -44,7 +44,7 @@
TEST_F(InstructionTest, Length) {
Instruction i(spv::Op::OpEntryPoint, {Operand::Float(1.2f), Operand::Int(1),
Operand::String("my_str")});
- EXPECT_EQ(i.word_length(), 5);
+ EXPECT_EQ(i.word_length(), 5u);
}
} // namespace
diff --git a/src/writer/spirv/operand_test.cc b/src/writer/spirv/operand_test.cc
index 681e8c4..0bb1c26 100644
--- a/src/writer/spirv/operand_test.cc
+++ b/src/writer/spirv/operand_test.cc
@@ -32,7 +32,7 @@
TEST_F(OperandTest, CreateInt) {
auto o = Operand::Int(1);
EXPECT_TRUE(o.IsInt());
- EXPECT_EQ(o.to_i(), 1);
+ EXPECT_EQ(o.to_i(), 1u);
}
TEST_F(OperandTest, CreateString) {
@@ -43,22 +43,22 @@
TEST_F(OperandTest, Length_Float) {
auto o = Operand::Float(1.2f);
- EXPECT_EQ(o.length(), 1);
+ EXPECT_EQ(o.length(), 1u);
}
TEST_F(OperandTest, Length_Int) {
auto o = Operand::Int(1);
- EXPECT_EQ(o.length(), 1);
+ EXPECT_EQ(o.length(), 1u);
}
TEST_F(OperandTest, Length_String) {
auto o = Operand::String("my string");
- EXPECT_EQ(o.length(), 3);
+ EXPECT_EQ(o.length(), 3u);
}
TEST_F(OperandTest, Length_String_Empty) {
auto o = Operand::String("");
- EXPECT_EQ(o.length(), 1);
+ EXPECT_EQ(o.length(), 1u);
}
} // namespace
diff --git a/tint_overrides_with_defaults.gni b/tint_overrides_with_defaults.gni
index 5732e2d..a8861ea 100644
--- a/tint_overrides_with_defaults.gni
+++ b/tint_overrides_with_defaults.gni
@@ -22,6 +22,11 @@
tint_spirv_tools_dir = "//third_party/spirv-tools"
}
+ # Path to googletest checkout
+ if (!defined(tint_googletest_dir)) {
+ tint_googletest_dir = "//third_party/googletest"
+ }
+
# Path to spirv-tools generated files, relative to |target_gen_dir|
if (!defined(tint_spirv_tools_gen)) {
tint_spirv_tools_gen = "third_party/spirv-tools"