|
| 1 | +/* |
| 2 | + * Copyright 2025 Intel Corporation |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +#include <svs/runtime/version.h> |
| 18 | +#include "catch2/catch_test_macros.hpp" |
| 19 | + |
| 20 | +// Validate macro is defined (like FAISS does) |
| 21 | +#ifndef FAISS_SVS_RUNTIME_VERSION |
| 22 | +#error "FAISS_SVS_RUNTIME_VERSION is not defined" |
| 23 | +#endif |
| 24 | + |
| 25 | +// Create namespace alias (FAISS integration pattern) |
| 26 | +SVS_RUNTIME_CREATE_API_ALIAS(svs_runtime, FAISS_SVS_RUNTIME_VERSION); |
| 27 | + |
| 28 | +CATCH_TEST_CASE("Version Namespace Compatibility", "[runtime][version]") { |
| 29 | + CATCH_SECTION("Namespace alias resolves to v0") { |
| 30 | + // Both access methods should give same values |
| 31 | + CATCH_REQUIRE(svs_runtime::VersionInfo::major == svs::runtime::v0::VersionInfo::major); |
| 32 | + CATCH_REQUIRE(svs_runtime::VersionInfo::minor == svs::runtime::v0::VersionInfo::minor); |
| 33 | + CATCH_REQUIRE(svs_runtime::VersionInfo::patch == svs::runtime::v0::VersionInfo::patch); |
| 34 | + } |
| 35 | + |
| 36 | + CATCH_SECTION("Version compatibility check") { |
| 37 | + // Should be compatible with v0 |
| 38 | + CATCH_REQUIRE(svs_runtime::VersionInfo::is_compatible_with_major(0)); |
| 39 | + |
| 40 | + // Should not be compatible with v1 |
| 41 | + CATCH_REQUIRE_FALSE(svs_runtime::VersionInfo::is_compatible_with_major(1)); |
| 42 | + } |
| 43 | + |
| 44 | + CATCH_SECTION("Version string") { |
| 45 | + // Verify version string is accessible |
| 46 | + CATCH_REQUIRE(svs_runtime::VersionInfo::get_version() != nullptr); |
| 47 | + CATCH_REQUIRE(svs_runtime::VersionInfo::get_api_namespace() != nullptr); |
| 48 | + } |
| 49 | +} |
0 commit comments