in Education by
OK, I have been working on a random image selector and queue system (so you don't see the same images too often). All was going swimmingly (as far as my crappy code does) until I got to the random bit. I wanted to test it, but how do you test for it? There is no Debug.Assert(i.IsRandom) (sadly) :D So, I got my brain on it after watering it with some tea and came up with the following, I was just wondering if I could have your thoughts? Basically I knew the random bit was the problem, so I ripped that out to a delegate (which would then be passed to the objects constructor). I then created a class that pretty much performs the same logic as the live code, but remembers the value selected in a private variable. I then threw that delegate to the live class and tested against that: i.e. Debug.Assert(myObj.RndVal == RndIntTester.ValuePassed); But I couldn't help but think, was I wasting my time? I ran that through lots of iterations to see if it fell over at any time etc. Do you think I was wasting my time with this? Or could I have got away with: GateKiller's answer reminded me of this: Update to Clarify I should add that I basically never want to see the same result more than X number of times from a pool of Y size. The addition of the test container basically allowed me to see if any of the previously selected images were "randomly" selected. I guess technically the thing here being tested in not the RNG (since I never wrote that code) but the fact that am I expecting random results from a limited pool, and I want to track them. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Test from the requirement : "so you don't see the same images too often" Ask for 100 images. Did you see an image too often?

Related questions

0 votes
    OK, I have been working on a random image selector and queue system (so you don't see the same ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 22, 2022 in Education by JackTerrance
0 votes
    OK, I have been working on a random image selector and queue system (so you don't see the same ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    OK, I have been working on a random image selector and queue system (so you don't see the same ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    OK, I have been working on a random image selector and queue system (so you don't see the same ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    OK, I have been working on a random image selector and queue system (so you don't see the same ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 20, 2022 in Education by JackTerrance
0 votes
    OK, I have been working on a random image selector and queue system (so you don't see the same ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
+1 vote
    Explain the API testing approach?...
asked Oct 15, 2020 in Technology by JackTerrance
0 votes
    On which of the following approach A basic line following robot is based? a) Applied approach b) Weak approach c) Strong approach d) Cognitive approach...
asked Jan 15, 2023 in Education by JackTerrance
0 votes
    Face Recognition system is based on which type of approach? a) Weak AI approach b) Applied AI approach c) Cognitive AI approach d) Strong AI approach...
asked Jan 15, 2023 in Education by JackTerrance
0 votes
    ________ is a simple approach to supervised learning. It assumes that the dependence of Y on X1, X2, . ... Regression of R Programming Select the correct answer from above options...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    An approach to website design with the emphasis on converting visitors to outcomes required by the owner is ... Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    Which is the software development approach that first emphasized on incorporating customer feedback early and often? A. Agile B. DevOps C. Waterfall D. Lean...
asked Oct 27, 2020 by JackTerrance
0 votes
    Is it possible to generate this kind of random curves? I've tried IMagick bezier curves (see http:/ ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
0 votes
    Three coins are tossed once. Describe the following events associated with this random experiment: A = Getting ... compound events? Select the correct answer from above options...
asked Nov 22, 2021 in Education by JackTerrance
...