// GENERATED FILE - DO NOT EDIT.
// Generated by generate_tests.py
//
// Copyright (c) 2022 Google LLC.
//
// 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 "../diff_test_utils.h"

#include "gtest/gtest.h"

namespace spvtools {
namespace diff {
namespace {

// Test that OpTypeAccelerationStructureNV and OpTypeRayQueryKHR are
// matched.
constexpr char kSrc[] = R"(OpCapability RayQueryKHR
OpCapability Shader
OpExtension "SPV_KHR_ray_query"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %43 "main"
OpExecutionMode %43 LocalSize 1 1 1
%2 = OpTypeVoid
%3 = OpTypeAccelerationStructureNV
%13 = OpTypeRayQueryKHR
%44 = OpTypeFunction %2
%43 = OpFunction  %2  None %44
%42 = OpLabel
OpReturn
OpFunctionEnd)";
constexpr char kDst[] = R"(; SPIR-V
; Version: 1.4
; Generator: rspirv
; Bound: 95
OpCapability RayQueryKHR
OpCapability Shader
OpExtension "SPV_KHR_ray_query"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %43 "main"
OpExecutionMode %43 LocalSize 1 1 1
%2 = OpTypeVoid
%3 = OpTypeAccelerationStructureNV
%13 = OpTypeRayQueryKHR
%44 = OpTypeFunction %2
%43 = OpFunction  %2  None %44
%42 = OpLabel
OpReturn
OpFunctionEnd
)";

TEST(DiffTest, RayQueryTypes) {
  constexpr char kDiff[] = R"( ; SPIR-V
 ; Version: 1.6
 ; Generator: Khronos SPIR-V Tools Assembler; 0
 ; Bound: 45
 ; Schema: 0
 OpCapability RayQueryKHR
 OpCapability Shader
 OpExtension "SPV_KHR_ray_query"
 OpMemoryModel Logical GLSL450
 OpEntryPoint GLCompute %43 "main"
 OpExecutionMode %43 LocalSize 1 1 1
 %2 = OpTypeVoid
 %3 = OpTypeAccelerationStructureKHR
 %13 = OpTypeRayQueryKHR
 %44 = OpTypeFunction %2
 %43 = OpFunction %2 None %44
 %42 = OpLabel
 OpReturn
 OpFunctionEnd
)";
  Options options;
  DoStringDiffTest(kSrc, kDst, kDiff, options);
}

TEST(DiffTest, RayQueryTypesNoDebug) {
  constexpr char kSrcNoDebug[] = R"(OpCapability RayQueryKHR
OpCapability Shader
OpExtension "SPV_KHR_ray_query"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %43 "main"
OpExecutionMode %43 LocalSize 1 1 1
%2 = OpTypeVoid
%3 = OpTypeAccelerationStructureNV
%13 = OpTypeRayQueryKHR
%44 = OpTypeFunction %2
%43 = OpFunction  %2  None %44
%42 = OpLabel
OpReturn
OpFunctionEnd
)";
  constexpr char kDstNoDebug[] = R"(; SPIR-V
; Version: 1.4
; Generator: rspirv
; Bound: 95
OpCapability RayQueryKHR
OpCapability Shader
OpExtension "SPV_KHR_ray_query"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %43 "main"
OpExecutionMode %43 LocalSize 1 1 1
%2 = OpTypeVoid
%3 = OpTypeAccelerationStructureNV
%13 = OpTypeRayQueryKHR
%44 = OpTypeFunction %2
%43 = OpFunction  %2  None %44
%42 = OpLabel
OpReturn
OpFunctionEnd
)";
  constexpr char kDiff[] = R"( ; SPIR-V
 ; Version: 1.6
 ; Generator: Khronos SPIR-V Tools Assembler; 0
 ; Bound: 45
 ; Schema: 0
 OpCapability RayQueryKHR
 OpCapability Shader
 OpExtension "SPV_KHR_ray_query"
 OpMemoryModel Logical GLSL450
 OpEntryPoint GLCompute %43 "main"
 OpExecutionMode %43 LocalSize 1 1 1
 %2 = OpTypeVoid
 %3 = OpTypeAccelerationStructureKHR
 %13 = OpTypeRayQueryKHR
 %44 = OpTypeFunction %2
 %43 = OpFunction %2 None %44
 %42 = OpLabel
 OpReturn
 OpFunctionEnd
)";
  Options options;
  DoStringDiffTest(kSrcNoDebug, kDstNoDebug, kDiff, options);
}

}  // namespace
}  // namespace diff
}  // namespace spvtools
