FreeRDP
winpr/libwinpr/utils/test/TestVersion.c
1 
2 #include <winpr/crt.h>
3 
4 #include <winpr/version.h>
5 #include <winpr/winpr.h>
6 
7 int TestVersion(int argc, char* argv[])
8 {
9  const char* version = NULL;
10  const char* git = NULL;
11  const char* build = NULL;
12  int major = 0;
13  int minor = 0;
14  int revision = 0;
15  WINPR_UNUSED(argc);
16  WINPR_UNUSED(argv);
17  winpr_get_version(&major, &minor, &revision);
18 
19  if (major != WINPR_VERSION_MAJOR)
20  return -1;
21 
22  if (minor != WINPR_VERSION_MINOR)
23  return -1;
24 
25  if (revision != WINPR_VERSION_REVISION)
26  return -1;
27 
28  version = winpr_get_version_string();
29 
30  if (!version)
31  return -1;
32 
33  git = winpr_get_build_revision();
34 
35  if (!git)
36  return -1;
37 
38  if (strncmp(git, WINPR_GIT_REVISION, sizeof(WINPR_GIT_REVISION)) != 0)
39  return -1;
40 
41  build = winpr_get_build_config();
42 
43  if (!build)
44  return -1;
45 
46  return 0;
47 }