2 * SPDX-License-Identifier: LGPL-2.1-only
4 * Copyright (C) 2020 Francis Deslauriers <francis.deslauriers@efficios.com>
16 #include "common/smp.h"
18 struct parse_test_data
{
23 static struct parse_test_data parse_test_data
[] = {
31 { "18446744073709551615", -1 },
32 { "0-2147483647", -1 },
33 { "0-18446744073709551615", -1 },
49 { "2147483647\n", -1 },
50 { "18446744073709551615\n", -1 },
51 { "0-2147483647\n", -1 },
52 { "0-18446744073709551615\n", -1 },
59 { "0,4-6,127\n", 127 },
63 static int parse_test_data_len
= sizeof(parse_test_data
) / sizeof(parse_test_data
[0]);
69 plan_tests(parse_test_data_len
+ 1);
71 diag("Testing smp helpers");
73 for (i
= 0; i
< parse_test_data_len
; i
++) {
74 ret
= get_max_cpuid_from_mask(parse_test_data
[i
].buf
,
75 strlen(parse_test_data
[i
].buf
));
76 ok(ret
== parse_test_data
[i
].expected
,
77 "get_max_cpuid_from_mask '%s', expected: '%d', result: '%d'",
78 parse_test_data
[i
].buf
, parse_test_data
[i
].expected
, ret
);
81 ok(get_possible_cpus_array_len() > 0, "get_possible_cpus_array_len (%d > 0)", get_possible_cpus_array_len());