blob: ff9169ee95b3f5561c04f97cfffdaae44e6e6ce1 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "gtest/gtest.h"
#include "tools/kazoo/outputs.h"
#include "tools/kazoo/syscall_library.h"
#include "tools/kazoo/test_ir_test_one_protocol_two_methods.test.h"
#include "tools/kazoo/test_ir_test_one_protocol_two_methods_with_internal.test.h"
namespace {
TEST(AsmOutput, Simple) {
SyscallLibrary library;
ASSERT_TRUE(SyscallLibraryLoader::FromJson(k_test_one_protocol_two_methods, &library));
StringWriter writer;
ASSERT_TRUE(AsmOutput(library, &writer));
EXPECT_EQ(writer.Out(),
R"(// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// WARNING: THIS FILE IS MACHINE GENERATED BY //tools/kazoo. DO NOT EDIT.
m_syscall zx_couple_do_thing 0 1 1
m_syscall zx_couple_get_stuff 1 2 1
)");
}
TEST(AsmOutput, WithInternal) {
SyscallLibrary library;
ASSERT_TRUE(
SyscallLibraryLoader::FromJson(k_test_one_protocol_two_methods_with_internal, &library));
StringWriter writer;
ASSERT_TRUE(AsmOutput(library, &writer));
EXPECT_EQ(writer.Out(),
R"(// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// WARNING: THIS FILE IS MACHINE GENERATED BY //tools/kazoo. DO NOT EDIT.
m_syscall zx_couple_do_thing 0 1 0
m_syscall zx_couple_get_stuff 1 2 1
)");
}
} // namespace