test/TestMemory.c
void testWrite() {
	zero_ram();

	//Test one byte write
	assert(ram_bank[0] == 0);
	wmem_b(0, 'd');
	assert(ram_bank[0] == 'd');

	zero_ram();

	//Test two byte write on random positions
	assert(ram_bank[512] == 0);
	assert(ram_bank[513] == 0);
	assert(ram_bank[514] == 0);
	wmem_w(512, 0x6969);

	assert(ram_bank[512] == 0x69);
	assert(ram_bank[513] == 0x69);

	//Test the memory write repeat
	zero_ram();
	assert(ram_bank[512] == 0);
	assert(ram_bank[513] == 0);

	printf("Write memory test passed!\n");
}
/**
 * Tests how the system writes to memory. in order to actually only test the writing, we have to compare
 * the results by accessing the array directly. We wouldn't do that usually.
 */
Tests how the system writes to memory. in order to actually only test the writing, we have to compare
the results by accessing the array directly. We wouldn't do that usually.
Tests how the system writes to memory . in order to actually only test the writing we have to compare the results by accessing the array directly . We wouldn ' t do that usually .
void testWrite() {
	zero_ram();
	assert(ram_bank[0] == 0);
	wmem_b(0, 'd');
	assert(ram_bank[0] == 'd');
	zero_ram();
	assert(ram_bank[512] == 0);
	assert(ram_bank[513] == 0);
	assert(ram_bank[514] == 0);
	wmem_w(512, 0x6969);
	assert(ram_bank[512] == 0x69);
	assert(ram_bank[513] == 0x69);
	zero_ram();
	assert(ram_bank[512] == 0);
	assert(ram_bank[513] == 0);
	printf("Write memory test passed!\n");
}
void testWrite ( ) { zero_ram ( ) ; assert ( ram_bank [ 0 ] == 0 ) ; wmem_b ( 0 , ' ' ) ; assert ( ram_bank [ 0 ] == ' ' ) ; zero_ram ( ) ; assert ( ram_bank [ 512 ] == 0 ) ; assert ( ram_bank [ 513 ] == 0 ) ; assert ( ram_bank [ 514 ] == 0 ) ; wmem_w ( 512 , 0x6969 ) ; assert ( ram_bank [ 512 ] == 0x69 ) ; assert ( ram_bank [ 513 ] == 0x69 ) ; zero_ram ( ) ; assert ( ram_bank [ 512 ] == 0 ) ; assert ( ram_bank [ 513 ] == 0 ) ; printf ( " \n " ) ; }
Tests how the system writes to memory.
Tests how the system writes to memory .
//Test one byte write //Test two byte write on random positions //Test the memory write repeat