2 * SPDX-License-Identifier: LGPL-2.1-only
4 * Copyright (C) 2020 Francis Deslauriers <francis.deslauriers@efficios.com>
17 #include "../../libringbuffer/smp.h"
19 struct parse_test_data
{
24 static struct parse_test_data parse_test_data
[] = {
32 { "18446744073709551615", 0 },
33 { "0-2147483647", 0 },
34 { "0-18446744073709551615", 0 },
50 { "2147483647\n", 0 },
51 { "18446744073709551615\n", 0 },
52 { "0-2147483647\n", 0 },
53 { "0-18446744073709551615\n", 0 },
60 { "0,4-6,127\n", 128 },
64 static int parse_test_data_len
= sizeof(parse_test_data
) / sizeof(parse_test_data
[0]);
70 plan_tests(parse_test_data_len
+ 1);
72 diag("Testing smp helpers");
74 for (i
= 0; i
< parse_test_data_len
; i
++) {
75 ret
= get_num_possible_cpus_from_mask(parse_test_data
[i
].buf
,
76 strlen(parse_test_data
[i
].buf
));
77 ok(ret
== parse_test_data
[i
].expected
,
78 "get_num_possible_cpus_from_mask '%s', expected: '%d', result: '%d'",
79 parse_test_data
[i
].buf
, parse_test_data
[i
].expected
, ret
);
82 ok(num_possible_cpus() > 0, "num_possible_cpus (%d > 0)", num_possible_cpus());