xref: /netbsd-src/external/gpl2/dtc/dist/tests/char_literal.c (revision cc7d2833ecf67da5a5ddc470841931eb9f6723e4)
1 /*	$NetBSD: char_literal.c,v 1.1.1.3 2019/12/22 12:34:06 skrll Exp $	*/
2 
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 /*
5  * libfdt - Flat Device Tree manipulation
6  *	Testcase for character literals in dtc
7  * Copyright (C) 2006 David Gibson, IBM Corporation.
8  * Copyright (C) 2011 The Chromium Authors. All rights reserved.
9  */
10 #include <stdlib.h>
11 #include <stdio.h>
12 #include <string.h>
13 #include <stdint.h>
14 
15 #include <libfdt.h>
16 
17 #include "tests.h"
18 #include "testdata.h"
19 
main(int argc,char * argv[])20 int main(int argc, char *argv[])
21 {
22 	void *fdt;
23 	fdt32_t expected_cells[5];
24 
25 	expected_cells[0] = cpu_to_fdt32((unsigned char)TEST_CHAR1);
26 	expected_cells[1] = cpu_to_fdt32((unsigned char)TEST_CHAR2);
27 	expected_cells[2] = cpu_to_fdt32((unsigned char)TEST_CHAR3);
28 	expected_cells[3] = cpu_to_fdt32((unsigned char)TEST_CHAR4);
29 	expected_cells[4] = cpu_to_fdt32((unsigned char)TEST_CHAR5);
30 
31 	test_init(argc, argv);
32 	fdt = load_blob_arg(argc, argv);
33 
34 	check_getprop(fdt, 0, "char-literal-cells",
35 		      sizeof(expected_cells), expected_cells);
36 
37 	PASS();
38 }
39