1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file test_hardware.c
4 /// \brief Tests src/liblzma/api/lzma/hardware.h API functions
5 ///
6 /// Since the output values of these functions are hardware dependent, these
7 /// tests are trivial. They are simply used to detect errors and machines
8 /// that these function are not supported on.
9 //
10 // Author: Jia Tan
11 //
12 // This file has been put into the public domain.
13 // You can do whatever you want with this file.
14 //
15 ///////////////////////////////////////////////////////////////////////////////
16
17 #include "tests.h"
18 #include "mythread.h"
19
20
21 static void
22 test_lzma_physmem(void)
23 {
24 // NOTE: Use _skip instead of _fail because 0 can also mean that we
25 // don't know how to get this information on this operating system.
26 if (lzma_physmem() == 0)
27 assert_skip("Could not determine amount of physical memory");
28 }
29
30
31 static void
32 test_lzma_cputhreads(void)
33 {
34 #ifndef MYTHREAD_ENABLED
35 assert_skip("Threading support disabled");
36 #else
37 if (lzma_cputhreads() == 0)
38 assert_skip("Could not determine cpu core count");
39 #endif
40 }
41
42
43 extern int
44 main(int argc, char **argv)
45 {
46 tuktest_start(argc, argv);
47 tuktest_run(test_lzma_physmem);
48 tuktest_run(test_lzma_cputhreads);
49 return tuktest_end();
50 }