Skip to content

Commit

Permalink
Tests - Version Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Dec 5, 2023
1 parent def9c95 commit b7fa005
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tests/versiontests.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
#include <gtest/gtest.h>
#include "version.h"

using namespace Nickvision::Aura;

TEST(VersionTests, EmptyVersion)
{
Nickvision::Aura::Version v;
Version v;
EXPECT_EQ(v.empty(), true);
}

TEST(VersionTests, VersionFromStrings)
{
Version v1{ "2023.11.52" };
Version v2{ "2022.15.2" };
EXPECT_EQ(v1.toString(), "2023.11.52");
EXPECT_EQ(v2.toString(), "2022.15.2");
EXPECT_EQ(v1 > v2, true);
EXPECT_EQ(v2 < v1, true);
EXPECT_EQ(v1 == v2, false);
}

TEST(VersionTests, BetaVersion)
{
Version v{ "2010.5.0-beta1" };
EXPECT_EQ(v.getVersionType(), VersionType::Preview);
}

TEST(VersionTests, BadVersions)
{
EXPECT_THROW(Version(""), std::invalid_argument);
EXPECT_THROW(Version("2023"), std::invalid_argument);
EXPECT_THROW(Version("2023-11-0"), std::invalid_argument);
}

0 comments on commit b7fa005

Please sign in to comment.