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

29 lines
532 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 := &Module{
programStorage: program,
register: make([]float64, 256),
IO: make([]float64, 2),
}
err := module.Run()
assert.NoError(t, err)
assert.True(t, module.isStopped)
assert.Equal(t, float64(11), module.register[0])
}