| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 /* | 
|  | 2  * This file is part of Adblock Plus <http://adblockplus.org/>, | 
|  | 3  * Copyright (C) 2006-2015 Eyeo GmbH | 
|  | 4  * | 
|  | 5  * Adblock Plus is free software: you can redistribute it and/or modify | 
|  | 6  * it under the terms of the GNU General Public License version 3 as | 
|  | 7  * published by the Free Software Foundation. | 
|  | 8  * | 
|  | 9  * Adblock Plus is distributed in the hope that it will be useful, | 
|  | 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 12  * GNU General Public License for more details. | 
|  | 13  * | 
|  | 14  * You should have received a copy of the GNU General Public License | 
|  | 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
|  | 16  */ | 
|  | 17 | 
|  | 18 #include <gtest/gtest.h> | 
|  | 19 #include "IE_Version.h" | 
|  | 20 | 
|  | 21 /* | 
|  | 22  * Exact version tests enabled by default. | 
|  | 23  * If they are disabled, gtest will report 2 disabled tests. | 
|  | 24  */ | 
|  | 25 #if !defined(DISABLE_EXACT_TESTS) | 
|  | 26 #define exact(x) Exact##x | 
|  | 27 #else | 
|  | 28 #define exact(x) DISABLED_Exact##x | 
|  | 29 #endif | 
|  | 30 /* | 
|  | 31  * Define a default version as the current version of IE in general release. | 
|  | 32  * Predefine on the command line to compile tests for non-standard development e
    nvironments. | 
|  | 33  */ | 
|  | 34 #ifndef INSTALLED_IE_VERSION | 
|  | 35 #define INSTALLED_IE_VERSION 11 | 
|  | 36 #endif | 
|  | 37 | 
|  | 38 TEST(InstalledVersionStringTest, Sanity) | 
|  | 39 { | 
|  | 40   std::wstring version = AdblockPlus::IE::InstalledVersionString(); | 
|  | 41   ASSERT_FALSE(version.length() == 0); // separate test for default value | 
|  | 42   ASSERT_TRUE(version.length() >= 2); | 
|  | 43 } | 
|  | 44 | 
|  | 45 TEST(InstalledMajorVersionTest, Sanity) | 
|  | 46 { | 
|  | 47   int version = AdblockPlus::IE::InstalledMajorVersion(); | 
|  | 48   ASSERT_NE(version, 0); // separate test for default value | 
|  | 49   ASSERT_GE(version, 6); | 
|  | 50   ASSERT_LE(version, 12); | 
|  | 51   EXPECT_NE(version, 12); // This check will point out when the test needs updat
    ing. | 
|  | 52 } | 
|  | 53 | 
|  | 54 TEST(InstalledVersionStringTest, exact(PrefixOnly)) | 
|  | 55 { | 
|  | 56     std::wstring version = AdblockPlus::IE::InstalledVersionString(); | 
|  | 57     std::wstring expected = std::to_wstring(INSTALLED_IE_VERSION) + L"."; | 
|  | 58     ASSERT_EQ(expected, version.substr(0, expected.length())); | 
|  | 59 } | 
|  | 60 | 
|  | 61 TEST(InstalledMajorVersionTest, exact(MajorOnly)) | 
|  | 62 { | 
|  | 63   int version = AdblockPlus::IE::InstalledMajorVersion(); | 
|  | 64   ASSERT_EQ(version, INSTALLED_IE_VERSION); | 
|  | 65 } | 
| OLD | NEW | 
|---|