martinpiper / BDD6502

Behaviour Driven Development with 6502 code
27 stars 2 forks source link

ST register checking seems to be broken #2

Closed oziphantom closed 8 years ago

oziphantom commented 8 years ago

When testing the ST register state seems to pass no matter what

Then I expect register ST contain stN And I expect register ST contain stV And I expect register ST equal 0 And I expect register ST equal stZ

Passes, even though there is no way all of them can be true.

martinpiper commented 8 years ago

Odd. What was the decimal or hex value of ST?

martinpiper commented 8 years ago

Scenario: Machine status register tests Given I have a simple 6502 system

When I set register ST to 0
Then I expect register ST equal 0

When I set register ST to 1
Then I expect register ST equal stC

When I set register ST to 2
Then I expect register ST equal stZ

When I set register ST to 4
Then I expect register ST equal stI

When I set register ST to 8
Then I expect register ST equal stD

When I set register ST to 64
Then I expect register ST equal stV

When I set register ST to 128
Then I expect register ST equal stN

When I set register ST to 128+64
Then I expect register ST equal stN+stV
Then I expect register ST contain stN+stV
Then I expect register ST contain stN
Then I expect register ST contain stV

When I set register ST to 2+4
Then I expect register ST contain stZ
Then I expect register ST contain stI
Then I expect register ST equal stI+stZ
Then I expect register ST contain stI+stZ
oziphantom commented 8 years ago

It didn't give one, it just passed.

Your test above is only checking to make sure it passes, you need to check a fail case and see that it fails. In that a test design to test a correct case for something that always passes will still pass.

If if does fail then maybe it was a markup error that doesn't cause an error but causes the test to pass without being checked?

martinpiper commented 8 years ago

Yeah, I tried a few failing test cases just to be sure. They were then removed from the scenario. If you can reproduce let me know the register value and the failing steps.

On Sat, 16 Jan 2016 21:51 oziphantom notifications@github.com wrote:

It didn't give one, it just passed.

Your test above is only checking to make sure it passes, you need to check a fail case and see that it fails. In that a test design to test a correct case for something that always passes will still pass.

If if does fail then maybe it was a markup error that doesn't cause an error but causes the test to pass without being checked?

— Reply to this email directly or view it on GitHub https://github.com/martinpiper/BDD6502/issues/2#issuecomment-172208333.

oziphantom commented 8 years ago

Sadly the above is basically all I have left, as the original code has changed dramatically as has the test. So I will mark it as closed for now, and if I get another case in the future I will make a full state grab for forensics and open a new issue with it.