-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Alphametics tests to handle timeouts for longer tests #1029
base: main
Are you sure you want to change the base?
Conversation
Changed alphameticstests.fs to make all tests async and added xunit Timeout attribute to longest 3 tests with 2 secs for ``Puzzle with eight letters`` and 5 seconds each for ``Puzzle with ten letters and 199 addends`` and ``Puzzle with ten letters`` exercises.
|
||
[<Fact(Skip = "Remove this Skip property to run this test")>] | ||
let ``Puzzle with eight letters`` () = | ||
[<Fact(Timeout=2000,Skip = "Remove this Skip property to run this test")>] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea. The actual timeouts are slightly tricky to determine, but I'm fine with having some value here. That said, we currently can't merge this as the test runner will strip the attribute before it runs the tests:
type EnableAllTests() =
inherit SyntaxVisitor()
override _.VisitSynAttribute(attr: SynAttribute) : SynAttribute =
match attr.TypeName with
| LongIdentWithDots ([ ident ], _) when ident.idText = "Fact" ->
base.VisitSynAttribute
{ attr with
ArgExpr = SynExpr.Const(SynConst.Unit, attr.ArgExpr.Range) }
| _ -> base.VisitSynAttribute(attr)
Would you be interested in fixing that too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup will have a look at that shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will look at this. Which repo and file is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think timeouts should be discussed at the practise exercise specification, hence my other PR to update canonical json with a timeout property. This might include relative timings between tests as implied here between 8 versus 10 letter tests. The actual implementation would depend on the track maintainers factoring in the built in online test runner timeouts and language performance etc. I would probably default to 10 seconds per test, a propos of anything more specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already wrote a reply but it has inexplicably disappeared. What files do I need to look at?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #1029 (comment). I should have posted that comment here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martinfreedman Let me know if you need any help/pointers. The F# syntax tree can be tricky to work with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do. And yes the Diamond exercise does not use [<Fact>]
! I will add this into my solution when I have a chance (I have Covid right now). Any other exercises tests with non-standard Attributes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I have Covid right now)
Oh no! All the best.
Any other exercises tests with non-standard Attributes?
The simple-linked-list
exercise uses a [<Theory>]
attribute (which should actually be converted to multiple [<Fact>]
attributes.
I'm not entirely sure about the timeouts being in the prob-specs definition, but I'll post my thoughts there. Oh and I completely forgot to mention that the |
Speaking of the |
Changed alphameticstests.fs to make all tests async and added xunit Timeout attribute to longest 3 tests with 2 secs for
Puzzle with eight letters
and 5 seconds each forPuzzle with ten letters and 199 addends
andPuzzle with ten letters
exercises.And switch back on testrunner for this exercise.