File: TestHelpers.cpp

package info (click to toggle)
bornagain 23.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,936 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (24 lines) | stat: -rw-r--r-- 955 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "GUI/Model/Util/Path.h"
#include "Tests/GTestWrapper/google_test.h"

TEST(Helpers, VersionString)
{
    int vmajor(0), vminor(0);

    EXPECT_EQ(true, GUI::Path::parseVersion("199.19", vmajor, vminor));
    EXPECT_EQ(199, vmajor);
    EXPECT_EQ(19, vminor);

    EXPECT_FALSE(GUI::Path::parseVersion("1.0.0", vmajor, vminor));

    QString min_version("20.3");
    EXPECT_TRUE(GUI::Path::isVersionMatchMinimal("20.3", min_version));
    EXPECT_TRUE(GUI::Path::isVersionMatchMinimal("20.4", min_version));
    EXPECT_TRUE(GUI::Path::isVersionMatchMinimal("21.0", min_version));
    EXPECT_TRUE(GUI::Path::isVersionMatchMinimal("123.45", min_version));

    EXPECT_FALSE(GUI::Path::isVersionMatchMinimal("20.2", min_version));
    EXPECT_FALSE(GUI::Path::isVersionMatchMinimal("19.19", min_version));
    EXPECT_FALSE(GUI::Path::isVersionMatchMinimal("18.0", min_version));
    EXPECT_FALSE(GUI::Path::isVersionMatchMinimal("0.9", min_version));
}