Files
llvm-project/orc-rt/unittests/SPSWrapperFunctionBufferTest.cpp
Lang Hames 7fbfd1cff4 [orc-rt] Add SPS serialization for WrapperFunctionBuffer. (#157609)
Also adds orc_rt_WrapperFunctionBufferConstData to the C API to get a
constant pointer to a wrapper function buffer's data.
2025-09-09 14:23:08 +10:00

43 lines
1.4 KiB
C++

//===-- SPSWrapperFunctionBufferTest.cpp ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Test SPS serialization for WrapperFunctionBuffers.
//
//===----------------------------------------------------------------------===//
#include "orc-rt/SPSWrapperFunctionBuffer.h"
#include "SimplePackedSerializationTestUtils.h"
#include "gtest/gtest.h"
using namespace orc_rt;
static bool WFBEQ(const WrapperFunctionBuffer &LHS,
const WrapperFunctionBuffer &RHS) {
if (LHS.size() != RHS.size())
return false;
return memcmp(LHS.data(), RHS.data(), LHS.size()) == 0;
}
TEST(SPSWrapperFunctionBufferTest, EmptyBuffer) {
WrapperFunctionBuffer EB;
blobSerializationRoundTrip<SPSWrapperFunctionBuffer>(EB, WFBEQ);
}
TEST(SPSWrapperFunctionBufferTest, SmallBuffer) {
const char *Source = "foo";
auto EB = WrapperFunctionBuffer::copyFrom(Source);
blobSerializationRoundTrip<SPSWrapperFunctionBuffer>(EB, WFBEQ);
}
TEST(SPSWrapperFunctionBufferTest, BigBuffer) {
const char *Source = "The quick brown fox jumps over the lazy dog";
auto EB = WrapperFunctionBuffer::copyFrom(Source);
blobSerializationRoundTrip<SPSWrapperFunctionBuffer>(EB, WFBEQ);
}