12722ceddSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
32722ceddSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
42722ceddSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
52722ceddSAndrew Rist  * distributed with this work for additional information
62722ceddSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
72722ceddSAndrew Rist  * to you under the Apache License, Version 2.0 (the
82722ceddSAndrew Rist  * "License"); you may not use this file except in compliance
92722ceddSAndrew Rist  * with the License.  You may obtain a copy of the License at
102722ceddSAndrew Rist  *
112722ceddSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
122722ceddSAndrew Rist  *
132722ceddSAndrew Rist  * Unless required by applicable law or agreed to in writing,
142722ceddSAndrew Rist  * software distributed under the License is distributed on an
152722ceddSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162722ceddSAndrew Rist  * KIND, either express or implied.  See the License for the
172722ceddSAndrew Rist  * specific language governing permissions and limitations
182722ceddSAndrew Rist  * under the License.
192722ceddSAndrew Rist  *
202722ceddSAndrew Rist  *************************************************************/
212722ceddSAndrew Rist 
222722ceddSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_desktop.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "sal/config.h"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <cstddef>
30cdf0e10cSrcweir 
31*1ea33f33SDamjan Jovanovic #include "gtest/gtest.h"
32cdf0e10cSrcweir #include "rtl/ustring.h"
33cdf0e10cSrcweir #include "rtl/ustring.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include "../../source/deployment/inc/dp_version.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace {
38cdf0e10cSrcweir 
39*1ea33f33SDamjan Jovanovic class Test: public ::testing::Test {
40cdf0e10cSrcweir public:
41cdf0e10cSrcweir };
42cdf0e10cSrcweir 
TEST_F(Test,test)43*1ea33f33SDamjan Jovanovic TEST_F(Test, test) {
44cdf0e10cSrcweir     struct Data {
45cdf0e10cSrcweir         rtl::OUString version1;
46cdf0e10cSrcweir         rtl::OUString version2;
47cdf0e10cSrcweir         ::dp_misc::Order order;
48cdf0e10cSrcweir     };
49cdf0e10cSrcweir     static Data const data[] = {
50cdf0e10cSrcweir         { rtl::OUString(),
51cdf0e10cSrcweir           rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0.0000.00.0")),
52cdf0e10cSrcweir           ::dp_misc::EQUAL },
53cdf0e10cSrcweir         { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".01")),
54cdf0e10cSrcweir           rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0.1")),
55cdf0e10cSrcweir           ::dp_misc::EQUAL },
56cdf0e10cSrcweir         { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("10")),
57cdf0e10cSrcweir           rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")),
58cdf0e10cSrcweir           ::dp_misc::GREATER },
59cdf0e10cSrcweir         { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("9223372036854775808")),
60cdf0e10cSrcweir               // 2^63
61cdf0e10cSrcweir           rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("9223372036854775807")),
62cdf0e10cSrcweir           ::dp_misc::GREATER }
63cdf0e10cSrcweir     };
64cdf0e10cSrcweir     for (::std::size_t i = 0; i < sizeof data / sizeof (Data); ++i) {
65*1ea33f33SDamjan Jovanovic         ASSERT_EQ(
66cdf0e10cSrcweir             data[i].order,
67cdf0e10cSrcweir             ::dp_misc::compareVersions(data[i].version1, data[i].version2));
68cdf0e10cSrcweir         static ::dp_misc::Order const reverse[3] = {
69cdf0e10cSrcweir             ::dp_misc::GREATER, ::dp_misc::EQUAL, ::dp_misc::LESS
70cdf0e10cSrcweir         };
71*1ea33f33SDamjan Jovanovic         ASSERT_EQ(
72cdf0e10cSrcweir             reverse[data[i].order],
73cdf0e10cSrcweir             ::dp_misc::compareVersions(data[i].version2, data[i].version1));
74cdf0e10cSrcweir     }
75cdf0e10cSrcweir }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 
78cdf0e10cSrcweir }
79