CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
91 lines
3.7 KiB
C++
91 lines
3.7 KiB
C++
#include "InternalEvent.h"
|
|
#include <omp-tools.h>
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
using namespace omptest;
|
|
using namespace util;
|
|
|
|
TEST(InternalUtility, ExpectedDefault_Integer) {
|
|
// int: -2147483648 (decimal) = 0x80000000 (hexadecimal)
|
|
EXPECT_EQ(expectedDefault(int), 0x80000000);
|
|
EXPECT_EQ(expectedDefault(int), (0x1 << 31));
|
|
// int64_t: -9223372036854775808 (decimal) = 0x8000000000000000 (hexadecimal)
|
|
EXPECT_EQ(expectedDefault(int64_t), 0x8000000000000000);
|
|
EXPECT_EQ(expectedDefault(int64_t), (0x1L << 63));
|
|
}
|
|
|
|
TEST(InternalUtility, ExpectedDefault_Zero) {
|
|
// Expectedly zero
|
|
EXPECT_EQ(expectedDefault(size_t), 0);
|
|
EXPECT_EQ(expectedDefault(unsigned int), 0);
|
|
EXPECT_EQ(expectedDefault(ompt_id_t), 0);
|
|
EXPECT_EQ(expectedDefault(ompt_dispatch_t), 0);
|
|
EXPECT_EQ(expectedDefault(ompt_device_time_t), 0);
|
|
}
|
|
|
|
TEST(InternalUtility, ExpectedDefault_Nullpointer) {
|
|
// Expectedly nullptr
|
|
EXPECT_EQ(expectedDefault(const char *), nullptr);
|
|
EXPECT_EQ(expectedDefault(const void *), nullptr);
|
|
EXPECT_EQ(expectedDefault(int *), nullptr);
|
|
EXPECT_EQ(expectedDefault(void *), nullptr);
|
|
EXPECT_EQ(expectedDefault(ompt_data_t *), nullptr);
|
|
EXPECT_EQ(expectedDefault(ompt_device_t *), nullptr);
|
|
EXPECT_EQ(expectedDefault(ompt_frame_t *), nullptr);
|
|
EXPECT_EQ(expectedDefault(ompt_function_lookup_t), nullptr);
|
|
EXPECT_EQ(expectedDefault(ompt_id_t *), nullptr);
|
|
}
|
|
|
|
TEST(InternalUtility, MakeHexString_PointerValues) {
|
|
// IsPointer should only affect zero value
|
|
EXPECT_EQ(makeHexString(0, /*IsPointer=*/true), "(nil)");
|
|
EXPECT_EQ(makeHexString(0, /*IsPointer=*/false), "0x0");
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/true), "0xff");
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/false), "0xff");
|
|
}
|
|
|
|
TEST(InternalUtility, MakeHexString_MinimumBytes) {
|
|
// Return a minimum length, based on the (minimum) requested bytes
|
|
EXPECT_EQ(makeHexString(15, /*IsPointer=*/true, /*MinBytes=*/0), "0xf");
|
|
EXPECT_EQ(makeHexString(15, /*IsPointer=*/true, /*MinBytes=*/1), "0x0f");
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/true, /*MinBytes=*/0), "0xff");
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/true, /*MinBytes=*/1), "0xff");
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/true, /*MinBytes=*/2), "0x00ff");
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/true, /*MinBytes=*/3), "0x0000ff");
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/true, /*MinBytes=*/4),
|
|
"0x000000ff");
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/true, /*MinBytes=*/5),
|
|
"0x00000000ff");
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/true, /*MinBytes=*/6),
|
|
"0x0000000000ff");
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/true, /*MinBytes=*/7),
|
|
"0x000000000000ff");
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/true, /*MinBytes=*/8),
|
|
"0x00000000000000ff");
|
|
|
|
// Default to four bytes, if request exceeds eight byte range
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/true, /*MinBytes=*/9),
|
|
"0x000000ff");
|
|
|
|
// Disregard requested minimum byte width, if actual value exceeds it
|
|
EXPECT_EQ(makeHexString(1024, /*IsPointer=*/true, /*MinBytes=*/1), "0x400");
|
|
}
|
|
|
|
TEST(InternalUtility, MakeHexString_HexBase) {
|
|
// Cut off "0x" when requested
|
|
EXPECT_EQ(makeHexString(0, /*IsPointer=*/true, /*MinBytes=*/0,
|
|
/*ShowHexBase=*/false),
|
|
"(nil)");
|
|
EXPECT_EQ(makeHexString(0, /*IsPointer=*/false, /*MinBytes=*/0,
|
|
/*ShowHexBase=*/false),
|
|
"0");
|
|
EXPECT_EQ(makeHexString(0, /*IsPointer=*/false, /*MinBytes=*/1,
|
|
/*ShowHexBase=*/false),
|
|
"00");
|
|
EXPECT_EQ(makeHexString(255, /*IsPointer=*/true,
|
|
/*MinBytes=*/2,
|
|
/*ShowHexBase=*/false),
|
|
"00ff");
|
|
}
|