pyfrc
pyfrc copied to clipboard
Add simple test type that allows you to specify when buttons are pressed
This is the most common type of simplistic test one might want, I imagine. The primary usefulness I think would be exercising all your stuff, so you can be sure that they don't have syntax errors. Adding an additional function that gets called to check it is nice, but should be optional. Something like.. hm. I don't really know what this looks like. Maybe:
# port, button number?
release = (1, 1)
fire = (1,2)
# time, button to press (defaults to pressing for 0.2s)
tests = [
(1.0, release),
(2.0, fire),
..
]
run_button_test(tests)
@sarosenb you should do this.
I can see the usefulness of this. What is the 1.0 and 2.0 in the test list used for?
That would be the time to activate the button.
I think what you can do is, if you want to assert something at the end of a test you could have something like this:
port, button number?
release = (1, 1) fire = (1,2)
time, button to press (defaults to pressing for 0.2s),
(optional)lamda to be run at end #of test
tests = [ (1.0, release, lamda:assert(hal_data['pwm'][0]['val'] = 1), (2.0, fire), .. ]
On Wed, Dec 17, 2014 at 11:19 AM, Dustin Spicuzza [email protected] wrote:
That would be the time to activate the button.
— Reply to this email directly or view it on GitHub https://github.com/robotpy/pyfrc/issues/8#issuecomment-67347267.
yeah, the lambda thing was what I was thinking too.