OLD | NEW |
| (Empty) |
1 // Copyright 2007-2009 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 | |
16 #include "omaha/base/omaha_version.h" | |
17 #include "omaha/base/utils.h" | |
18 #include "omaha/testing/unit_test.h" | |
19 | |
20 namespace omaha { | |
21 | |
22 TEST(OmahaVersionTest, InitializeVersion) { | |
23 CString version_string = GetVersionString(); | |
24 ULONGLONG version = GetVersion(); | |
25 | |
26 EXPECT_STREQ(OMAHA_BUILD_VERSION_STRING, version_string); | |
27 EXPECT_EQ(OMAHA_BUILD_VERSION, version); | |
28 | |
29 InitializeVersion(MAKEDLLVERULL(0, 0, 0, 0)); | |
30 EXPECT_STREQ(_T("0.0.0.0"), GetVersionString()); | |
31 EXPECT_EQ(0, GetVersion()); | |
32 | |
33 InitializeVersion(MAKEDLLVERULL(1, 2, 3, 4)); | |
34 EXPECT_STREQ(_T("1.2.3.4"), GetVersionString()); | |
35 EXPECT_EQ(0x0001000200030004, GetVersion()); | |
36 | |
37 InitializeVersion(MAKEDLLVERULL(0x7fff, 0x7fff, 0x7fff, 0x7fff)); | |
38 EXPECT_STREQ(_T("32767.32767.32767.32767"), GetVersionString()); | |
39 EXPECT_EQ(0x7fff7fff7fff7fff, GetVersion()); | |
40 | |
41 InitializeVersion(MAKEDLLVERULL(0xffff, 0xffff, 0xffff, 0xffff)); | |
42 EXPECT_STREQ(_T("65535.65535.65535.65535"), GetVersionString()); | |
43 EXPECT_EQ(0xffffffffffffffff, GetVersion()); | |
44 | |
45 // Sets back the initial version. | |
46 InitializeVersion(VersionFromString(version_string)); | |
47 EXPECT_STREQ(version_string, GetVersionString()); | |
48 EXPECT_EQ(version, GetVersion()); | |
49 } | |
50 | |
51 } // namespace omaha | |
OLD | NEW |