You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hal/hal/module_test.go

26 lines
479 B

package hal
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestModule_Run(t *testing.T) {
program := Program{
0: &ProgrammedInstruction{
Instruction: InstructionStart,
},
10: &ProgrammedInstruction{
Instruction: InstructionStop,
},
}
module, err := NewHALModule(program, 256, 2, true)
assert.NoError(t, err)
err = module.Run()
assert.NoError(t, err)
assert.True(t, module.isStopped)
assert.Equal(t, float64(11), module.register[0])
}