summaryrefslogtreecommitdiffstats
path: root/tests/flashrom.c
blob: ad46dd8da44f327efb9d2b7ab235bab9798686d4 (plain)
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
#include <include/test.h>

#include "programmer.h"

void flashbuses_to_text_test_success(void **state)
{
	(void) state; /* unused */

	enum chipbustype bustype;

	bustype = BUS_NONSPI;
	assert_string_equal(flashbuses_to_text(bustype), "Non-SPI");

	bustype |= BUS_PARALLEL;
	assert_string_not_equal(flashbuses_to_text(bustype), "Non-SPI, Parallel");

	bustype = BUS_PARALLEL;
	bustype |= BUS_LPC;
	assert_string_equal(flashbuses_to_text(bustype), "Parallel, LPC");

	bustype |= BUS_FWH;
	//BUS_NONSPI = BUS_PARALLEL | BUS_LPC | BUS_FWH,
	assert_string_equal(flashbuses_to_text(bustype), "Non-SPI");

	bustype |= BUS_SPI;
	assert_string_equal(flashbuses_to_text(bustype), "Parallel, LPC, FWH, SPI");

	bustype |= BUS_PROG;
	assert_string_equal(
			flashbuses_to_text(bustype),
			"Parallel, LPC, FWH, SPI, Programmer-specific"
	);

	bustype = BUS_NONE;
	assert_string_equal(flashbuses_to_text(bustype), "None");
}