Comments (4)
After some thought:
-
I'll create a PR to initially ignore all but the first test
-
Having looked at the test names and test order in the canonical data for the exercise here:
I see that the test order, test names, and the test with description 'each ability is only calculated once' (which tests nothing as far as I can make out) are all reflected in the tests on this track, so I'd be hesitant creating a PR to change any of these locally (I'm not sure how in-sync these things have to be).
I think at this point I'm going to say that I simply don't like this particular exercise and move on.
from typescript.
I think these are very good questions, but the answers aren't exceptionally straight-forward. Here are a few comments based on your issue, but this is not a full-fledged response to the entire thing as a whole (as I'm a bit time constrained right now -- but I did want to give you some response soon).
- As you mentioned, the common canonical problem specification gives a bit of insight on what is possible and what's not possible. If the abstract phrasing there is applied to TypeScript, it's basically saying:
- It is impossible to test for randomness. You can only make a test that attempts to find within some reasonable probability that something is truly random. For example, a test with checks that asserts if the first 10 dice rolls are not all 6 are, however improbable, not actually testing that it's random. Getting 10 rolls of 6, assuming true randomness, is about
1.65e-8
which is small, but definitely in the space of possibility. Making the number larger makes it less probably that this test fails when something is truly random, but it doesn't test for it. - It is possible to test the usage of the randomizer (in other words: is the randomizer being called when you expect it).
- It is possible to invert the tests making it more and more probable that something is implemented correctly.
- The whole thing about property based testing is more a note for implementers and not for students, and it's there because it attempts to explain how maintainers could implement this test suite in their track.
- It is impossible to test for randomness. You can only make a test that attempts to find within some reasonable probability that something is truly random. For example, a test with checks that asserts if the first 10 dice rolls are not all 6 are, however improbable, not actually testing that it's random. Getting 10 rolls of 6, assuming true randomness, is about
- From the original issue: exercism/problem-specifications#616 and the original PR exercism/problem-specifications#1397 we can find some of the discussion of what you mention. Basically it was determined that we (at this point) do not at randomness tests but usage of randomness (for example: exercism/problem-specifications#1397 (comment))
- This then means that most tests get a "best effort" approach (aka: exercism/problem-specifications#1397 (comment)).
- The
.prop === .prop
tests try to guard forget prop() { return somethingRandom() }
, which is much more common in some other languages, but that's why it is as it is.
A few thoughts based on your observations:
- The order of the tests is sub-optimal. I will take a PR to make this better. Go for it if you feel like doing that, or we can leave this issue open is necessary.
- The fact that none of the tests is ignored/skipped is a bug. This should be fixed. Go for it if you feel like doing that.
- I think what may be good is mocking
Math.rand()
as we want people to use that anyway -- butCrypto.getRandomValues()
technically could be used too. This would be additional tests, which I think would be a good idea here. - I don't understand your comment about "this exercise comes after Space Age". Can you elaborate on this, so I can help figuring out how we may solve this?
from typescript.
Thanks for the in-depth response - I'll read the original idea for the exercise you linked to for more context 👍
Regarding "this exercise comes after Space Age", I was referring to the order of the exercises I encountered on this track, which I had assumed was always the same. Is that the case, or is it different each time?
from typescript.
Thanks @ireddick for your issue and PR!
from typescript.
Related Issues (20)
- At least one deadlink in the REPO HOT 1
- Test-Cases of `rational-numbers` exercise satisfied by dummy-implementation
- [Grade School] Tests fail on a valid approach
- Lack to add documentation references in the exercise instructions. HOT 5
- Instructions for the exercise Secret handshake (typescript exercise #16) are confusing HOT 3
- Spelling issue in Largest Series Product
- [Grade School] Can't use Readonly<> types for later tests HOT 7
- Update Pig Latin tests HOT 1
- `word-count` exercise test not aligned with instructions HOT 1
- ESLint cannot find already installed plugins when linting exercises in local environment HOT 12
- yarn install / yarn test does not work out of the box for typescript exercises HOT 2
- Building a training set of tags for typescript HOT 21
- hello world not work HOT 1
- Deprecated String.prototype.substr() in robot-name.test.ts HOT 1
- Why does two-bucket use both xtest and test.skip ? HOT 1
- Two-Fer exercise skips 2/3 tests with `xit` HOT 2
- 'Robot Name' false positive tests HOT 6
- Exercise Word Count in Typescript. Tests are wrong
- Missing test case for problem "luhn"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript.