Sigridtest c9clunk379fb049 years agoHistory
55 lines · 1.3 KB · C
RawDownload
#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <setjmp.h>#include <cmocka.h>#include "m68k.h"#include "run.h"#include "sym.h"#include "tests.h" static voidtest_c9create_end(void){	uint8_t *ctx, *b; 	ctx = mem+m68k_get_reg(NULL, M68K_REG_A0);	assert_ptr_equal(ctx, mem+Ctx);	b = mem+Begindst;	assert_int_equal(ru32le(b), bufsz); // size	assert_int_equal(b[4], EXPR_Tcreate); // type	assert_int_equal(ru16le(b+5), 0); // tag	assert_int_equal(ru32le(b+7), 0x12345678); // fid	assert_int_equal(b[11], EXPR_C9write); // mode	assert_int_equal(ru32le(b+12), 0755); // perm	assert_int_equal(ru16le(b+16), 13); // name len	assert_memory_equal(b+18, "some_file.txt", 13); // name	assert_int_equal(b[18+13], fill);	executed |= End;} voidtest_c9create(void **state){	uint8_t *ctx;	uint16_t sr; 	(void)state;	ctx = mem+Ctx;	initctx(ctx, Msize);	c9begin = generic_begin;	c9end = test_c9create_end;	executed = 0;	m68k_set_reg(M68K_REG_A0, Ctx);	m68k_set_reg(M68K_REG_A1, Tmp); strcpy((char*)mem+Tmp, "some_file.txt");	m68k_set_reg(M68K_REG_D0, 0x12345678);	m68k_set_reg(M68K_REG_D1, EXPR_C9write);	m68k_set_reg(M68K_REG_D2, 0755);	jsr(Progstart+SYM_c9create);	sr = m68k_get_reg(NULL, M68K_REG_SR);	assert_false(sr & SR_C); 	// check if the data buffer was used	assert_int_equal(executed, Begin|End);}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t