// 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/tint/lang/spirv/writer/operand.h"

#include "gtest/gtest.h"

namespace tint::spirv::writer {
namespace {

using SpirvWriterOperandtest = testing::Test;

TEST_F(SpirvWriterOperandtest, CreateFloat) {
    auto o = Operand(1.2f);
    ASSERT_TRUE(std::holds_alternative<float>(o));
    EXPECT_FLOAT_EQ(std::get<float>(o), 1.2f);
}

TEST_F(SpirvWriterOperandtest, CreateInt) {
    auto o = Operand(1u);
    ASSERT_TRUE(std::holds_alternative<uint32_t>(o));
    EXPECT_EQ(std::get<uint32_t>(o), 1u);
}

TEST_F(SpirvWriterOperandtest, CreateString) {
    auto o = Operand("my string");
    ASSERT_TRUE(std::holds_alternative<std::string>(o));
    EXPECT_EQ(std::get<std::string>(o), "my string");
}

TEST_F(SpirvWriterOperandtest, Length_Float) {
    auto o = Operand(1.2f);
    EXPECT_EQ(OperandLength(o), 1u);
}

TEST_F(SpirvWriterOperandtest, Length_Int) {
    auto o = U32Operand(1);
    EXPECT_EQ(OperandLength(o), 1u);
}

TEST_F(SpirvWriterOperandtest, Length_String) {
    auto o = Operand("my string");
    EXPECT_EQ(OperandLength(o), 3u);
}

TEST_F(SpirvWriterOperandtest, Length_String_Empty) {
    auto o = Operand("");
    EXPECT_EQ(OperandLength(o), 1u);
}

}  // namespace
}  // namespace tint::spirv::writer
