Skip to content

Request instructionCounter in GodmodeState #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jgfoster opened this issue Sep 11, 2020 · 4 comments
Closed

Request instructionCounter in GodmodeState #160

jgfoster opened this issue Sep 11, 2020 · 4 comments
Labels
arduino mocks Compilation mocks for the Arduino library duplicate This issue or pull request already exists enhancement New feature or request

Comments

@jgfoster
Copy link
Member

Sometimes we need to test not just the value of pins but the order in which they are set. For example, many devices (such as LiquidCrystal) have a "clock" pin that is used to inform the device that the other pins have now been populated with useful values (see LiquidCrystal.cpp:303).

At first it seems that this could be done by incrementing the microsecond clock with each instruction but this is unrealistic (it implies a 1MHz machine) and makes some other tests less practical (it is nice that Blink can test for exactly microseconds for a delay() call).

My suggestion is that each event also have an instruction counter so we could determine what pin values were set before the clock pulse. Or is there something that does this that I'm missing?

@ianfixes
Copy link
Collaborator

The closest thing I got to was manually incrementing the clock after calls (in this hokey example where I make the time increments the fibonacci sequence to see what non-incremental jumps in time look like during testing. But this does nothing for things that happen within a library -- in that case all the events will have the same time.

This is related to #136 and #145

My rough idea was to make a nice way to report godmode changes as events that the test code could somehow subscribe to. That would allow you to set your own delays for the various function calls. I'm not sure yet how I'd structure that into what's there already, but that's as far as the idea got.

@ianfixes ianfixes added arduino mocks Compilation mocks for the Arduino library duplicate This issue or pull request already exists enhancement New feature or request labels Sep 12, 2020
@jgfoster
Copy link
Member Author

My rough idea was to make a nice way to report godmode changes as events that the test code could somehow subscribe to.

I'm interested in this idea. I see that PinHistory is a subclass of ObservableDataStream and that a test could subscribe to an individual pin (perhaps a clock pin). In what way is this insufficient? I started down a path of adding a general event, but (while I like it) now wonder if it is needed.

@jgfoster
Copy link
Member Author

Now that I'm using ObservableDataStream I'm able to capture the events I want in their proper order so I'm happy to have this closed and since you tagged it as a duplicate I'll assume that keeping it open doesn't add much value (though you are certainly free to reopen it!).

@ianfixes
Copy link
Collaborator

I'd like to steer the conversation to those other issues since the folks who raised them have a broader sense of use cases than I do and I'm really interested in their opinions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arduino mocks Compilation mocks for the Arduino library duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants