aboutsummaryrefslogtreecommitdiff
path: root/tests/test_hardware.c
blob: c72d9b28fd077b168371b46aaed48551b8714153 (plain) (blame)
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
48
49
50
///////////////////////////////////////////////////////////////////////////////
//
/// \file       test_hardware.c
/// \brief      Tests src/liblzma/api/lzma/hardware.h API functions
///
/// Since the output values of these functions are hardware dependent, these
/// tests are trivial. They are simply used to detect errors and machines
/// that these function are not supported on.
//
//  Author:     Jia Tan
//
//  This file has been put into the public domain.
//  You can do whatever you want with this file.
//
///////////////////////////////////////////////////////////////////////////////

#include "tests.h"
#include "mythread.h"


static void
test_lzma_physmem(void)
{
	// NOTE: Use _skip instead of _fail because 0 can also mean that we
	// don't know how to get this information on this operating system.
	if (lzma_physmem() == 0)
		assert_skip("Could not determine amount of physical memory");
}


static void
test_lzma_cputhreads(void)
{
#ifndef MYTHREAD_ENABLED
	assert_skip("Threading support disabled");
#else
	if (lzma_cputhreads() == 0)
		assert_skip("Could not determine cpu core count");
#endif
}


extern int
main(int argc, char **argv)
{
	tuktest_start(argc, argv);
	tuktest_run(test_lzma_physmem);
	tuktest_run(test_lzma_cputhreads);
	return tuktest_end();
}