brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 99b72b8 Raw
43 lines · cpp
1//===-- SPSWrapperFunctionBufferTest.cpp ----------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// Test SPS serialization for WrapperFunctionBuffers.10//11//===----------------------------------------------------------------------===//12 13#include "orc-rt/SPSWrapperFunctionBuffer.h"14 15#include "SimplePackedSerializationTestUtils.h"16#include "gtest/gtest.h"17 18using namespace orc_rt;19 20static bool WFBEQ(const WrapperFunctionBuffer &LHS,21                  const WrapperFunctionBuffer &RHS) {22  if (LHS.size() != RHS.size())23    return false;24  return memcmp(LHS.data(), RHS.data(), LHS.size()) == 0;25}26 27TEST(SPSWrapperFunctionBufferTest, EmptyBuffer) {28  WrapperFunctionBuffer EB;29  blobSerializationRoundTrip<SPSWrapperFunctionBuffer>(EB, WFBEQ);30}31 32TEST(SPSWrapperFunctionBufferTest, SmallBuffer) {33  const char *Source = "foo";34  auto EB = WrapperFunctionBuffer::copyFrom(Source);35  blobSerializationRoundTrip<SPSWrapperFunctionBuffer>(EB, WFBEQ);36}37 38TEST(SPSWrapperFunctionBufferTest, BigBuffer) {39  const char *Source = "The quick brown fox jumps over the lazy dog";40  auto EB = WrapperFunctionBuffer::copyFrom(Source);41  blobSerializationRoundTrip<SPSWrapperFunctionBuffer>(EB, WFBEQ);42}43