2016-01-07 18:44:22 +00:00
|
|
|
// Copyright (c) 2015-2016 The Khronos Group Inc.
|
2015-05-22 17:26:19 +00:00
|
|
|
//
|
2016-09-01 19:33:59 +00:00
|
|
|
// 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
|
2015-05-22 17:26:19 +00:00
|
|
|
//
|
2016-09-01 19:33:59 +00:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2015-05-22 17:26:19 +00:00
|
|
|
//
|
2016-09-01 19:33:59 +00:00
|
|
|
// 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.
|
2015-05-22 17:26:19 +00:00
|
|
|
|
2016-04-07 18:41:34 +00:00
|
|
|
#include <gmock/gmock.h>
|
|
|
|
|
2016-09-22 15:05:30 +00:00
|
|
|
#include "unit_spirv.h"
|
2015-05-22 17:26:19 +00:00
|
|
|
|
2015-08-31 19:24:32 +00:00
|
|
|
namespace {
|
|
|
|
|
2016-08-05 22:19:30 +00:00
|
|
|
using GetTargetOpcodeTableGetTest = ::testing::TestWithParam<spv_target_env>;
|
2016-04-07 18:41:34 +00:00
|
|
|
using ::testing::ValuesIn;
|
|
|
|
|
2016-08-05 22:19:30 +00:00
|
|
|
TEST_P(GetTargetOpcodeTableGetTest, SanityCheck) {
|
2015-05-22 17:26:19 +00:00
|
|
|
spv_opcode_table table;
|
2016-04-07 18:41:34 +00:00
|
|
|
ASSERT_EQ(SPV_SUCCESS, spvOpcodeTableGet(&table, GetParam()));
|
2015-11-18 14:22:10 +00:00
|
|
|
ASSERT_NE(0u, table->count);
|
2015-05-22 17:26:19 +00:00
|
|
|
ASSERT_NE(nullptr, table->entries);
|
|
|
|
}
|
|
|
|
|
2016-08-05 22:19:30 +00:00
|
|
|
TEST_P(GetTargetOpcodeTableGetTest, InvalidPointerTable) {
|
2016-04-07 18:41:34 +00:00
|
|
|
ASSERT_EQ(SPV_ERROR_INVALID_POINTER, spvOpcodeTableGet(nullptr, GetParam()));
|
2015-05-22 17:26:19 +00:00
|
|
|
}
|
2015-08-31 19:24:32 +00:00
|
|
|
|
2016-08-05 22:19:30 +00:00
|
|
|
INSTANTIATE_TEST_CASE_P(OpcodeTableGet, GetTargetOpcodeTableGetTest,
|
|
|
|
ValuesIn(spvtest::AllTargetEnvironments()));
|
2016-04-07 18:41:34 +00:00
|
|
|
|
2015-08-31 19:24:32 +00:00
|
|
|
} // anonymous namespace
|