blob: 1dcae138eb12d26d2f2bd8037cc2d7c1c4bc4319 [file] [log] [blame]
// Copyright 2022 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 <sstream>
#include "src/tint/ir/temp.h"
#include "src/tint/ir/test_helper.h"
namespace tint::ir {
namespace {
using namespace tint::number_suffixes; // NOLINT
using IR_TempTest = TestHelper;
TEST_F(IR_TempTest, id) {
auto& b = CreateEmptyBuilder();
std::stringstream str;
b.builder.next_temp_id = Temp::Id(4);
auto* val = b.builder.Temp();
EXPECT_EQ(4u, val->AsId());
val->ToString(str);
EXPECT_EQ("%4", str.str());
}
} // namespace
} // namespace tint::ir