53 lines
1.8 KiB
C++
53 lines
1.8 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// (c) Copyright, Ubisoft Entertainment Inc. || Created by Harbour //
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
#include "tests/config.h"
|
|
#include "tests/fixture/memoryCheckFixture.h"
|
|
#include <ubiservices/version.h>
|
|
|
|
namespace US_NS {;
|
|
US_DEFINE_TEST(TestVersion);
|
|
};
|
|
|
|
typedef US_NS::LeakChecker PUBLIC_API;
|
|
|
|
/// @test Verifies that the macro name does not change and returns version 1 (in the main branch)
|
|
/// @note This test must be modified in the release branches.
|
|
TEST_F(PUBLIC_API, LOCAL_Version)
|
|
{
|
|
using namespace US_NS;
|
|
|
|
struct Local
|
|
{
|
|
static const char* const getReleaseTypeName(uint32 releaseType)
|
|
{
|
|
switch (releaseType)
|
|
{
|
|
case 0: return "Preview";
|
|
case 1: return "Release";
|
|
default: ADD_FAILURE(); break;
|
|
}
|
|
|
|
return "";
|
|
}
|
|
};
|
|
|
|
// Set these values to match release number
|
|
// -----------------------------------------------
|
|
const uint32 VERSION_MAJOR = 2019ul; // ex: 2018
|
|
const uint32 VERSION_TYPE = 0x01ul; // ex: 0 for Preview
|
|
const uint32 VERSION_REVISION = 11ul; // ex: 6 for rev 6
|
|
const uint32 VERSION_CHANGELIST = 1ul; // ex: 123456
|
|
// -----------------------------------------------
|
|
|
|
EXPECT_EQ(VERSION_CHANGELIST, US_SDK_CHANGELIST);
|
|
|
|
// 0xYYYttrr
|
|
// YYY = Year (Ex: 0x7E2 for 2018)
|
|
// tt = Release type (ex: 0x00 for Preview and 0x01 for Release)
|
|
// rr = Revision (ex: 0x01 for rev 1)
|
|
// Ex: 2018.Release.4 = 0x7E20104
|
|
EXPECT_EQ((VERSION_MAJOR << 16) + (VERSION_TYPE << 8) + VERSION_REVISION, US_SDK_VERSION);
|
|
|
|
EXPECT_EQ(String::formatText("%d.%s.%d", VERSION_MAJOR, Local::getReleaseTypeName(VERSION_TYPE), VERSION_REVISION), US_SDK_VERSION_CONST_CHAR);
|
|
}
|