Freecodecamp: Challenge No repeats please - some test cases missing

Created on 26 Feb 2016  路  4Comments  路  Source: freeCodeCamp/freeCodeCamp

Hi,

regarding the challenge "No repeats please", I just found some solution featured in http://www.twitch.tv/freecodecamp/v/50517350 which should not pass. Two test cases that would make it fail in different ways:

permAlone("a") should return 1
permAlone("aaab") should return 0
Reasoning: There is no test case for return value of 0 with more than one type of character, so one might be tempted to test whether there are only characters of one type. For "a", this is true, while the return value is not 0. For "aaab" this is false, but the return value is 0.

permAlone("aaabb") should return 12
Reasoning: There is no test case for more than two occurences of a single character apart from the return-0 cases. For 1 and 2, the factorial is the same as the number, so some implementations break at 3.

Most helpful comment

Yes, I think so. Those are the simplest test cases for those two misconceptions I could find.

All 4 comments

Hey there, I want to help.

@Blauelf @erictleung Are these the tests that you need to be put in?

"assert.strictEqual(permAlone('a'), 1, 'message: <code>permAlone(\"a\")</code> should return 1.');",
"assert.strictEqual(permAlone('aaab'), 0, 'message: <code>permAlone(\"aaab\")</code> should return 0.');",
"assert.strictEqual(permAlone('aaabb'), 12, 'message: <code>permAlone(\"aaabb\")</code> should return 12.');"

Yes, I think so. Those are the simplest test cases for those two misconceptions I could find.

@sharang-d looks good to me! Read the contributing guidelines and visit the Contributors Help Room if you have any questions about making a Pull Request.

Thanks, will hopefully have a PR ready for review soon. 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raisedadead picture raisedadead  路  3Comments

danielonodje picture danielonodje  路  3Comments

EthanDavis picture EthanDavis  路  3Comments

ar5had picture ar5had  路  3Comments

jurijuri picture jurijuri  路  3Comments