Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff committed Mar 3, 2023
1 parent 9a5bb8d commit 589f013
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/include/opentelemetry/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

#define OPENTELEMETRY_ABI_VERSION_NO 1
#define OPENTELEMETRY_VERSION "1.8.2"
#define OPENTELEMETRY_VERSION_MAJOR 1
#define OPENTELEMETRY_VERSION_MINOR 8
#define OPENTELEMETRY_VERSION_PATCH 2

#define OPENTELEMETRY_ABI_VERSION OPENTELEMETRY_STRINGIFY(OPENTELEMETRY_ABI_VERSION_NO)

// clang-format off
Expand Down
15 changes: 15 additions & 0 deletions api/test/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,18 @@ cc_test(
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "version_test",
srcs = [
"version_test.cc",
],
tags = [
"api",
"test",
],
deps = [
"//api",
"@com_google_googletest//:gtest_main",
],
)
8 changes: 8 additions & 0 deletions api/test/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@ gtest_add_tests(
TARGET timestamp_test
TEST_PREFIX trace.
TEST_LIST timestamp_test)

add_executable(version_test version_test.cc)
target_link_libraries(version_test ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(
TARGET version_test
TEST_PREFIX version.
TEST_LIST version_test)
16 changes: 16 additions & 0 deletions api/test/core/version_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/version.h"

#include <gtest/gtest.h>

TEST(VersionTest, Consistency)
{
char expected[10];
sprintf(expected, "%d.%d.%d", OPENTELEMETRY_VERSION_MAJOR, OPENTELEMETRY_VERSION_MINOR,
OPENTELEMETRY_VERSION_PATCH);

std::string actual = OPENTELEMETRY_VERSION;
EXPECT_EQ(actual, expected);
}

0 comments on commit 589f013

Please sign in to comment.