diff options
author | dan sinclair <dj2@everburning.com> | 2018-11-22 16:57:29 -0500 |
---|---|---|
committer | David Neto <dneto@google.com> | 2018-11-22 16:57:29 -0500 |
commit | da74d350d628dca19c9ac2b6c057e518203eb3f3 (patch) | |
tree | af761aa698eb184bfd861edb06ba0ed7edcf9045 /src/amberscript | |
parent | fcef06cabdfb1cb5c13001ebae8bb5e2b14681bf (diff) | |
download | amber-da74d350d628dca19c9ac2b6c057e518203eb3f3.tar.gz |
Add cpplint (#90)
Add cpplint
Diffstat (limited to 'src/amberscript')
-rw-r--r-- | src/amberscript/parser.cc | 2 | ||||
-rw-r--r-- | src/amberscript/parser_test.cc | 106 | ||||
-rw-r--r-- | src/amberscript/pipeline.h | 4 | ||||
-rw-r--r-- | src/amberscript/pipeline_test.cc | 12 | ||||
-rw-r--r-- | src/amberscript/script.h | 2 | ||||
-rw-r--r-- | src/amberscript/script_test.cc | 4 | ||||
-rw-r--r-- | src/amberscript/shader.h | 2 |
7 files changed, 77 insertions, 55 deletions
diff --git a/src/amberscript/parser.cc b/src/amberscript/parser.cc index 07a201b..68a6752 100644 --- a/src/amberscript/parser.cc +++ b/src/amberscript/parser.cc @@ -16,6 +16,8 @@ #include <cassert> #include <limits> +#include <utility> +#include <vector> #include "src/make_unique.h" #include "src/tokenizer.h" diff --git a/src/amberscript/parser_test.cc b/src/amberscript/parser_test.cc index c697718..276ac4b 100644 --- a/src/amberscript/parser_test.cc +++ b/src/amberscript/parser_test.cc @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "src/amberscript/parser.h" +#include <vector> + #include "gtest/gtest.h" +#include "src/amberscript/parser.h" namespace amber { namespace amberscript { @@ -140,13 +142,14 @@ TEST_P(AmberScriptParserShaderPassThroughTest, ShaderPassThroughWithoutVertex) { "allowed", r.Error()); } -INSTANTIATE_TEST_CASE_P(AmberScriptParserShaderPassThroughTests, - AmberScriptParserShaderPassThroughTest, - testing::Values(NameData{"fragment"}, - NameData{"geometry"}, - NameData{"tessellation_evaluation"}, - NameData{"tessellation_control"}, - NameData{"compute"}), ); +INSTANTIATE_TEST_CASE_P( + AmberScriptParserShaderPassThroughTests, + AmberScriptParserShaderPassThroughTest, + testing::Values(NameData{"fragment"}, + NameData{"geometry"}, + NameData{"tessellation_evaluation"}, + NameData{"tessellation_control"}, + NameData{"compute"}), ); // NOLINT(whitespace/parens) TEST_F(AmberScriptParserTest, ShaderPassThroughUnknownShaderType) { std::string in = "SHADER UNKNOWN my_shader PASSTHROUGH"; @@ -326,7 +329,9 @@ INSTANTIATE_TEST_CASE_P( ShaderType::kTessellationEvaluation}, ShaderTypeData{"tessellation_control", ShaderType::kTessellationControl}, - ShaderTypeData{"compute", ShaderType::kCompute}), ); + ShaderTypeData{ + "compute", + ShaderType::kCompute}), ); // NOLINT(whitespace/parens) using AmberScriptParserShaderFormatTest = testing::TestWithParam<ShaderFormatData>; @@ -358,9 +363,12 @@ TEST_P(AmberScriptParserShaderFormatTest, ShaderFormats) { INSTANTIATE_TEST_CASE_P( AmberScriptParserTestsShaderFormat, AmberScriptParserShaderFormatTest, - testing::Values(ShaderFormatData{"GLSL", ShaderFormat::kGlsl}, - ShaderFormatData{"SPIRV-ASM", ShaderFormat::kSpirvAsm}, - ShaderFormatData{"SPIRV-HEX", ShaderFormat::kSpirvHex}), ); + testing::Values( + ShaderFormatData{"GLSL", ShaderFormat::kGlsl}, + ShaderFormatData{"SPIRV-ASM", ShaderFormat::kSpirvAsm}, + ShaderFormatData{ + "SPIRV-HEX", + ShaderFormat::kSpirvHex}), ); // NOLINT(whitespace/parens) TEST_F(AmberScriptParserTest, DuplicateShaderName) { std::string in = R"( @@ -629,13 +637,15 @@ END)"; INSTANTIATE_TEST_CASE_P( AmberScriptParserPipelineAttachTests, AmberScriptParserPipelineAttachTest, - testing::Values(ShaderTypeData{"vertex", ShaderType::kVertex}, - ShaderTypeData{"fragment", ShaderType::kFragment}, - ShaderTypeData{"geometry", ShaderType::kGeometry}, - ShaderTypeData{"tessellation_evaluation", - ShaderType::kTessellationEvaluation}, - ShaderTypeData{"tessellation_control", - ShaderType::kTessellationControl}), ); + testing::Values( + ShaderTypeData{"vertex", ShaderType::kVertex}, + ShaderTypeData{"fragment", ShaderType::kFragment}, + ShaderTypeData{"geometry", ShaderType::kGeometry}, + ShaderTypeData{"tessellation_evaluation", + ShaderType::kTessellationEvaluation}, + ShaderTypeData{ + "tessellation_control", + ShaderType::kTessellationControl}), ); // NOLINT(whitespace/parens) TEST_F(AmberScriptParserTest, PipelineEntryPoint) { std::string in = R"( @@ -1598,7 +1608,9 @@ INSTANTIATE_TEST_CASE_P( BufferTypeData{"index", BufferType::kIndex}, BufferTypeData{"sampled", BufferType::kSampled}, BufferTypeData{"color", BufferType::kColor}, - BufferTypeData{"depth", BufferType::kDepth}), ); + BufferTypeData{ + "depth", + BufferType::kDepth}), ); // NOLINT(whitespace/parens) using AmberScriptParserBufferDataTypeTest = testing::TestWithParam<BufferData>; TEST_P(AmberScriptParserBufferDataTypeTest, BufferTypes) { @@ -1639,7 +1651,8 @@ INSTANTIATE_TEST_CASE_P( BufferData{"vec4<uint32>", DataType::kUint32, 4, 1}, BufferData{"mat2x4<int32>", DataType::kInt32, 2, 4}, BufferData{"mat3x3<float>", DataType::kFloat, 3, 3}, - BufferData{"mat4x2<uint16>", DataType::kUint16, 4, 2}), ); + BufferData{"mat4x2<uint16>", DataType::kUint16, 4, + 2}), ); // NOLINT(whitespace/parens) using AmberScriptParserBufferDataTypeInvalidTest = testing::TestWithParam<NameData>; @@ -1654,31 +1667,32 @@ TEST_P(AmberScriptParserBufferDataTypeInvalidTest, BufferTypes) { ASSERT_FALSE(r.IsSuccess()) << test_data.name; EXPECT_EQ("1: invalid data_type provided", r.Error()) << test_data.name; } -INSTANTIATE_TEST_CASE_P(AmberScriptParserBufferDataTypeInvalidTest, - AmberScriptParserBufferDataTypeInvalidTest, - testing::Values(NameData{"int17"}, - NameData{"uintt0"}, - NameData{"vec7<uint8>"}, - NameData{"vec27<uint8>"}, - NameData{"vec2<vec2<float>>"}, - NameData{"vec2<mat2x2<float>>"}, - NameData{"vec2float>"}, - NameData{"vec2<uint32"}, - NameData{"vec2<uint4>"}, - NameData{"vec2<>"}, - NameData{"vec2"}, - NameData{"mat1x1<double>"}, - NameData{"mat5x2<double>"}, - NameData{"mat2x5<double>"}, - NameData{"mat22x22<double>"}, - NameData{"matx5<double>"}, - NameData{"mat2<double>"}, - NameData{"mat2x<double>"}, - NameData{"mat2x2<vec4<float>>"}, - NameData{"mat2x2<mat3x3<double>>"}, - NameData{"mat2x2<unit7>"}, - NameData{"mat2x2"}, - NameData{"mat2x2<>"}), ); +INSTANTIATE_TEST_CASE_P( + AmberScriptParserBufferDataTypeInvalidTest, + AmberScriptParserBufferDataTypeInvalidTest, + testing::Values(NameData{"int17"}, + NameData{"uintt0"}, + NameData{"vec7<uint8>"}, + NameData{"vec27<uint8>"}, + NameData{"vec2<vec2<float>>"}, + NameData{"vec2<mat2x2<float>>"}, + NameData{"vec2float>"}, + NameData{"vec2<uint32"}, + NameData{"vec2<uint4>"}, + NameData{"vec2<>"}, + NameData{"vec2"}, + NameData{"mat1x1<double>"}, + NameData{"mat5x2<double>"}, + NameData{"mat2x5<double>"}, + NameData{"mat22x22<double>"}, + NameData{"matx5<double>"}, + NameData{"mat2<double>"}, + NameData{"mat2x<double>"}, + NameData{"mat2x2<vec4<float>>"}, + NameData{"mat2x2<mat3x3<double>>"}, + NameData{"mat2x2<unit7>"}, + NameData{"mat2x2"}, + NameData{"mat2x2<>"}), ); // NOLINT(whitespace/parens) } // namespace amberscript } // namespace amber diff --git a/src/amberscript/pipeline.h b/src/amberscript/pipeline.h index 3bf5d68..99a1198 100644 --- a/src/amberscript/pipeline.h +++ b/src/amberscript/pipeline.h @@ -30,7 +30,7 @@ class Pipeline { public: class ShaderInfo { public: - ShaderInfo(const Shader*); + explicit ShaderInfo(const Shader*); ShaderInfo(const ShaderInfo&); ~ShaderInfo(); @@ -52,7 +52,7 @@ class Pipeline { std::string entry_point_; }; - Pipeline(PipelineType type); + explicit Pipeline(PipelineType type); ~Pipeline(); PipelineType GetType() const { return pipeline_type_; } diff --git a/src/amberscript/pipeline_test.cc b/src/amberscript/pipeline_test.cc index 4d6f366..b0866f1 100644 --- a/src/amberscript/pipeline_test.cc +++ b/src/amberscript/pipeline_test.cc @@ -97,11 +97,13 @@ TEST_P(AmberScriptPipelineComputePipelineTest, INSTANTIATE_TEST_CASE_P( AmberScriptPipelineComputePipelineTests, AmberScriptPipelineComputePipelineTest, - testing::Values(ShaderTypeData{ShaderType::kVertex}, - ShaderTypeData{ShaderType::kFragment}, - ShaderTypeData{ShaderType::kGeometry}, - ShaderTypeData{ShaderType::kTessellationEvaluation}, - ShaderTypeData{ShaderType::kTessellationControl}), ); + testing::Values( + ShaderTypeData{ShaderType::kVertex}, + ShaderTypeData{ShaderType::kFragment}, + ShaderTypeData{ShaderType::kGeometry}, + ShaderTypeData{ShaderType::kTessellationEvaluation}, + ShaderTypeData{ + ShaderType::kTessellationControl}), ); // NOLINT(whitespace/parens) TEST_F(AmberScriptPipelineTest, SettingComputeShaderToGraphicsPipeline) { Shader c(ShaderType::kCompute); diff --git a/src/amberscript/script.h b/src/amberscript/script.h index 5ddcc0a..fd394a1 100644 --- a/src/amberscript/script.h +++ b/src/amberscript/script.h @@ -17,6 +17,8 @@ #include <map> #include <memory> +#include <string> +#include <utility> #include <vector> #include "src/amberscript/pipeline.h" diff --git a/src/amberscript/script_test.cc b/src/amberscript/script_test.cc index f1a168e..e117ccd 100644 --- a/src/amberscript/script_test.cc +++ b/src/amberscript/script_test.cc @@ -12,9 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "src/amberscript/script.h" +#include <utility> + #include "gtest/gtest.h" #include "src/amberscript/pipeline.h" +#include "src/amberscript/script.h" #include "src/amberscript/shader.h" #include "src/buffer.h" #include "src/make_unique.h" diff --git a/src/amberscript/shader.h b/src/amberscript/shader.h index eb6e1a2..0d17f21 100644 --- a/src/amberscript/shader.h +++ b/src/amberscript/shader.h @@ -24,7 +24,7 @@ namespace amberscript { class Shader { public: - Shader(ShaderType type); + explicit Shader(ShaderType type); ~Shader(); ShaderType GetType() const { return shader_type_; } |