wined3d: Implement more GLSL instructions and a little cleanup.
[wine] / dlls / kernel / tests / version.c
1 /*
2  * Unit test suite for version functions
3  *
4  * Copyright 2006 Robert Shearman
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include "wine/test.h"
22 #include "winbase.h"
23
24 START_TEST(version)
25 {
26     OSVERSIONINFOEX info = { sizeof(info) };
27     BOOL ret;
28
29     ret = VerifyVersionInfo(&info, VER_MAJORVERSION | VER_MINORVERSION,
30         VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL));
31     todo_wine ok(ret, "VerifyVersionInfo failed with error %ld\n", GetLastError());
32
33     ret = VerifyVersionInfo(&info, VER_BUILDNUMBER | VER_MAJORVERSION |
34         VER_MINORVERSION/* | VER_PLATFORMID | VER_SERVICEPACKMAJOR |
35         VER_SERVICEPACKMINOR | VER_SUITENAME | VER_PRODUCT_TYPE */,
36         VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL));
37     todo_wine ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
38         "VerifyVersionInfo should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
39
40     /* tests special handling of VER_SUITENAME */
41
42     ret = VerifyVersionInfo(&info, VER_SUITENAME,
43         VerSetConditionMask(0, VER_SUITENAME, VER_AND));
44     ok(ret, "VerifyVersionInfo failed with error %ld\n", GetLastError());
45
46     ret = VerifyVersionInfo(&info, VER_SUITENAME,
47         VerSetConditionMask(0, VER_SUITENAME, VER_OR));
48     ok(ret, "VerifyVersionInfo failed with error %ld\n", GetLastError());
49
50     /* test handling of version numbers */
51     
52     /* v3.10 is always less than v4.x even
53      * if the minor version is tested */
54     info.dwMajorVersion = 3;
55     info.dwMinorVersion = 10;
56     ret = VerifyVersionInfo(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
57         VerSetConditionMask(VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL),
58             VER_MAJORVERSION, VER_GREATER_EQUAL));
59     todo_wine ok(ret, "VerifyVersionInfo failed with error %ld\n", GetLastError());
60
61     info.dwMinorVersion = 0;
62     info.wServicePackMajor = 10;
63     ret = VerifyVersionInfo(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
64         VerSetConditionMask(VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL),
65             VER_MAJORVERSION, VER_GREATER_EQUAL));
66     todo_wine ok(ret, "VerifyVersionInfo failed with error %ld\n", GetLastError());
67
68     info.wServicePackMajor = 0;
69     info.wServicePackMinor = 10;
70     ret = VerifyVersionInfo(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
71         VerSetConditionMask(VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL),
72             VER_MAJORVERSION, VER_GREATER_EQUAL));
73     todo_wine ok(ret, "VerifyVersionInfo failed with error %ld\n", GetLastError());
74
75     GetVersionEx((OSVERSIONINFO *)&info);
76     info.wServicePackMinor++;
77     ret = VerifyVersionInfo(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
78         VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
79     todo_wine ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
80         "VerifyVersionInfo should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
81
82     /* test the failure hierarchy for the four version fields */
83
84     GetVersionEx((OSVERSIONINFO *)&info);
85     info.wServicePackMajor++;
86     ret = VerifyVersionInfo(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
87         VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
88     todo_wine ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
89         "VerifyVersionInfo should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
90
91     GetVersionEx((OSVERSIONINFO *)&info);
92     info.dwMinorVersion++;
93     ret = VerifyVersionInfo(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
94         VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
95     ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
96         "VerifyVersionInfo should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
97
98     GetVersionEx((OSVERSIONINFO *)&info);
99     info.dwMajorVersion++;
100     ret = VerifyVersionInfo(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
101         VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
102     todo_wine ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
103         "VerifyVersionInfo should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
104
105     ret = VerifyVersionInfo(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
106         VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
107     todo_wine ok(ret, "VerifyVersionInfo failed with error %ld\n", GetLastError());
108
109
110     /* shows that build number fits into the hierarchy after major version, but before minor version */
111     GetVersionEx((OSVERSIONINFO *)&info);
112     info.dwBuildNumber++;
113     ret = VerifyVersionInfo(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
114         VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
115     todo_wine ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
116         "VerifyVersionInfo should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
117
118     ret = VerifyVersionInfo(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
119         VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
120     todo_wine ok(ret, "VerifyVersionInfo failed with error %ld\n", GetLastError());
121
122     /* test bad dwOSVersionInfoSize */
123     GetVersionEx((OSVERSIONINFO *)&info);
124     info.dwOSVersionInfoSize = 0;
125     ret = VerifyVersionInfo(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
126         VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
127     todo_wine ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
128         "VerifyVersionInfo should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
129 }