Repository navigation
bank-account: add to track - #662
Conversation
|
[FYI: Kotlin has an implementation of this exercise that might be inspirational, but I'm not sure if it's compliant with any canonical data!] |
e6d5728 to
e3021a4
Compare
| "difficulty": 6, | ||
| "topics": [ | ||
|
|
||
| ] |
e3021a4 to
ec72772
Compare
| assertEquals(0, bankAccount.getBalance()); | ||
| } | ||
|
|
||
| @Ignore |
There was a problem hiding this comment.
All @Ignore annotations should include the standard hint: "Remove to run test" :)
There was a problem hiding this comment.
Sorry, forgot! Will fix :)
| bankAccount.deposit(1000); | ||
|
|
||
| for (int i = 0; i < 10; i++) { | ||
| adjustBalanceConcurrently(); |
There was a problem hiding this comment.
Does this test fail 100% of the time? If so, would you mind explaining how that works? I'm curious!
There was a problem hiding this comment.
Ah, I see from the hint it is not guaranteed to fail. Can we provide any recommendation as to how many times a user should run this test to be "reasonably certain" their implementation is threadsafe? Alternatively, can we inject a little more thread control into solutions to be able to pull the appropriate levers ourselves and guarantee a concurrent modification attempt?
There was a problem hiding this comment.
It failed every time I ran it (I think I ran it about 10 times in a row) with a non-threadsafe implementation. Is there any way we can be absolutely guarantee a concurrent modification attempt? I would expect the test to fail every time if their implementation isn't thread safe, but I can't be 100% certain. I could put in the hint that they should run the test a couple of times just to be safe?
There was a problem hiding this comment.
Cool, I see the same behavior here. Let's add to the hint just to be safe :)
|
Love it! Great add. |
Description
Reviewer Resources:
Track Policies