summaryrefslogtreecommitdiffstats
path: root/winpr/libwinpr/utils/test/TestVersion.c
blob: 71a1d74d907e764b4ac6e9e4b3ab8f3d48bdca28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <winpr/crt.h>

#include <winpr/version.h>
#include <winpr/winpr.h>

int TestVersion(int argc, char* argv[])
{
	const char* version = NULL;
	const char* git = NULL;
	const char* build = NULL;
	int major = 0;
	int minor = 0;
	int revision = 0;
	WINPR_UNUSED(argc);
	WINPR_UNUSED(argv);
	winpr_get_version(&major, &minor, &revision);

	if (major != WINPR_VERSION_MAJOR)
		return -1;

	if (minor != WINPR_VERSION_MINOR)
		return -1;

	if (revision != WINPR_VERSION_REVISION)
		return -1;

	version = winpr_get_version_string();

	if (!version)
		return -1;

	git = winpr_get_build_revision();

	if (!git)
		return -1;

	if (strncmp(git, WINPR_GIT_REVISION, sizeof(WINPR_GIT_REVISION)))
		return -1;

	build = winpr_get_build_config();

	if (!build)
		return -1;

	return 0;
}