BuildBot fix, compiler complains about array decay to pointer
[llvm-core.git] / unittests / Support / VersionTupleTest.cpp
blobcd7ecda5fefd39b2b755025e95c9eea78d23b917
1 //===- VersionTupleTests.cpp - Version Number Handling Tests --------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
10 #include "llvm/Support/VersionTuple.h"
11 #include "gtest/gtest.h"
13 using namespace llvm;
15 TEST(VersionTuple, getAsString) {
16 EXPECT_EQ("0", VersionTuple().getAsString());
17 EXPECT_EQ("1", VersionTuple(1).getAsString());
18 EXPECT_EQ("1.2", VersionTuple(1, 2).getAsString());
19 EXPECT_EQ("1.2.3", VersionTuple(1, 2, 3).getAsString());
20 EXPECT_EQ("1.2.3.4", VersionTuple(1, 2, 3, 4).getAsString());
23 TEST(VersionTuple, tryParse) {
24 VersionTuple VT;
26 EXPECT_FALSE(VT.tryParse("1"));
27 EXPECT_EQ("1", VT.getAsString());
29 EXPECT_FALSE(VT.tryParse("1.2"));
30 EXPECT_EQ("1.2", VT.getAsString());
32 EXPECT_FALSE(VT.tryParse("1.2.3"));
33 EXPECT_EQ("1.2.3", VT.getAsString());
35 EXPECT_FALSE(VT.tryParse("1.2.3.4"));
36 EXPECT_EQ("1.2.3.4", VT.getAsString());
38 EXPECT_TRUE(VT.tryParse(""));
39 EXPECT_TRUE(VT.tryParse("1."));
40 EXPECT_TRUE(VT.tryParse("1.2."));
41 EXPECT_TRUE(VT.tryParse("1.2.3."));
42 EXPECT_TRUE(VT.tryParse("1.2.3.4."));
43 EXPECT_TRUE(VT.tryParse("1.2.3.4.5"));
44 EXPECT_TRUE(VT.tryParse("1-2"));
45 EXPECT_TRUE(VT.tryParse("1+2"));
46 EXPECT_TRUE(VT.tryParse(".1"));
47 EXPECT_TRUE(VT.tryParse(" 1"));
48 EXPECT_TRUE(VT.tryParse("1 "));
49 EXPECT_TRUE(VT.tryParse("."));