예제 #1
0
func (s *MySuite) TestRectL(t *C) {
	locs := ConvertToLoCs(translation.LoadFileContent("resources/hasm/rect/RectL.asm"))
	expectedLines := strings.Split(translation.LoadFileContent("resources/hasm/rect/RectL.hack"), "\n")
	for _, loc := range locs {
		if loc.targetIndex >= 0 {
			sourcePrefix := loc.String() + " -> "
			t.Assert(sourcePrefix+loc.translation, Equals, sourcePrefix+expectedLines[loc.targetIndex])
		}
	}
}
예제 #2
0
func (s *MySuite) TestVM(t *C) {
	translation := translation.LoadFileContent("resources/hvm/StackArithmetic/SimpleAdd/SimpleAdd.vm")
	fmt.Print(new(VMCompiler).Translate(translation))
}