TEST_F(ValidateData, storage_uniform_16_good) { std::string str = HeaderWith("StorageUniform16 OpExtension \"SPV_KHR_16bit_storage\"") + "%2 = OpTypeInt 16 1 %3 = OpTypeFloat 16"; CompileSuccessfully(str.c_str()); ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); }
TEST_P(GeneratorStringTest, Sample) { auto words = CompileSuccessfully(""); EXPECT_EQ(2u, SPV_INDEX_GENERATOR_NUMBER); words[SPV_INDEX_GENERATOR_NUMBER] = SPV_GENERATOR_WORD(GetParam().generator, GetParam().misc); spv_text decoded_text = nullptr; EXPECT_THAT(spvBinaryToText(ScopedContext().context, words.data(), words.size(), SPV_BINARY_TO_TEXT_OPTION_NONE, &decoded_text, &diagnostic), Eq(SPV_SUCCESS)); EXPECT_THAT(diagnostic, Eq(nullptr)); EXPECT_THAT(std::string(decoded_text->str), HasSubstr(GetParam().expected)); spvTextDestroy(decoded_text); }
// Number of bits in a float may be only one of: {16,32,64} TEST_F(ValidateData, float_invalid_num_bits) { std::string str = header + "%2 = OpTypeFloat 48"; CompileSuccessfully(str.c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(invalid_num_bits_error)); }
TEST_F(ValidateData, float64_bad) { std::string str = header + "%2 = OpTypeFloat 64"; CompileSuccessfully(str.c_str()); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr(missing_float64_cap_error)); }
TEST_F(ValidateData, float64_good) { std::string str = header_with_float64 + "%2 = OpTypeFloat 64"; CompileSuccessfully(str.c_str()); ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); }
TEST_F(ValidateData, int16_good) { std::string str = header_with_int16 + "%2 = OpTypeInt 16 1"; CompileSuccessfully(str.c_str()); ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); }