test_dp_version.cxx (2722cedd) | test_dp_version.cxx (1ea33f33) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 14 unchanged lines hidden (view full) --- 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_desktop.hxx" 26 27#include "sal/config.h" 28 29#include <cstddef> 30 | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 14 unchanged lines hidden (view full) --- 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_desktop.hxx" 26 27#include "sal/config.h" 28 29#include <cstddef> 30 |
31#include "cppunit/TestAssert.h" 32#include "cppunit/TestFixture.h" 33#include "cppunit/extensions/HelperMacros.h" 34#include "cppunit/plugin/TestPlugIn.h" | 31#include "gtest/gtest.h" |
35#include "rtl/ustring.h" 36#include "rtl/ustring.hxx" 37 38#include "../../source/deployment/inc/dp_version.hxx" 39 40namespace { 41 | 32#include "rtl/ustring.h" 33#include "rtl/ustring.hxx" 34 35#include "../../source/deployment/inc/dp_version.hxx" 36 37namespace { 38 |
42class Test: public ::CppUnit::TestFixture { | 39class Test: public ::testing::Test { |
43public: | 40public: |
44 void test(); 45 46 CPPUNIT_TEST_SUITE(Test); 47 CPPUNIT_TEST(test); 48 CPPUNIT_TEST_SUITE_END(); | |
49}; 50 | 41}; 42 |
51void Test::test() { | 43TEST_F(Test, test) { |
52 struct Data { 53 rtl::OUString version1; 54 rtl::OUString version2; 55 ::dp_misc::Order order; 56 }; 57 static Data const data[] = { 58 { rtl::OUString(), 59 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0.0000.00.0")), --- 5 unchanged lines hidden (view full) --- 65 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")), 66 ::dp_misc::GREATER }, 67 { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("9223372036854775808")), 68 // 2^63 69 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("9223372036854775807")), 70 ::dp_misc::GREATER } 71 }; 72 for (::std::size_t i = 0; i < sizeof data / sizeof (Data); ++i) { | 44 struct Data { 45 rtl::OUString version1; 46 rtl::OUString version2; 47 ::dp_misc::Order order; 48 }; 49 static Data const data[] = { 50 { rtl::OUString(), 51 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0.0000.00.0")), --- 5 unchanged lines hidden (view full) --- 57 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")), 58 ::dp_misc::GREATER }, 59 { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("9223372036854775808")), 60 // 2^63 61 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("9223372036854775807")), 62 ::dp_misc::GREATER } 63 }; 64 for (::std::size_t i = 0; i < sizeof data / sizeof (Data); ++i) { |
73 CPPUNIT_ASSERT_EQUAL( | 65 ASSERT_EQ( |
74 data[i].order, 75 ::dp_misc::compareVersions(data[i].version1, data[i].version2)); 76 static ::dp_misc::Order const reverse[3] = { 77 ::dp_misc::GREATER, ::dp_misc::EQUAL, ::dp_misc::LESS 78 }; | 66 data[i].order, 67 ::dp_misc::compareVersions(data[i].version1, data[i].version2)); 68 static ::dp_misc::Order const reverse[3] = { 69 ::dp_misc::GREATER, ::dp_misc::EQUAL, ::dp_misc::LESS 70 }; |
79 CPPUNIT_ASSERT_EQUAL( | 71 ASSERT_EQ( |
80 reverse[data[i].order], 81 ::dp_misc::compareVersions(data[i].version2, data[i].version1)); 82 } 83} 84 | 72 reverse[data[i].order], 73 ::dp_misc::compareVersions(data[i].version2, data[i].version1)); 74 } 75} 76 |
85CPPUNIT_TEST_SUITE_REGISTRATION(Test); | |
86 87} | 77 78} |
88 89CPPUNIT_PLUGIN_IMPLEMENT(); | |