Coder Social home page Coder Social logo

Comments (4)

ireddick avatar ireddick commented on June 4, 2024 1

After some thought:

  1. I'll create a PR to initially ignore all but the first test

  2. Having looked at the test names and test order in the canonical data for the exercise here:

https://github.com/exercism/problem-specifications/blob/main/exercises/dnd-character/canonical-data.json

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.

SleeplessByte avatar SleeplessByte commented on June 4, 2024

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).

  1. 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.
  2. 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))
  3. This then means that most tests get a "best effort" approach (aka: exercism/problem-specifications#1397 (comment)).
  4. The .prop === .prop tests try to guard for get 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:

  1. 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.
  2. 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.
  3. I think what may be good is mocking Math.rand() as we want people to use that anyway -- but Crypto.getRandomValues() technically could be used too. This would be additional tests, which I think would be a good idea here.
  4. 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.

ireddick avatar ireddick commented on June 4, 2024

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.

SleeplessByte avatar SleeplessByte commented on June 4, 2024

Thanks @ireddick for your issue and PR!

from typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.