Created
January 2, 2018 14:38
-
-
Save isabolic/153ac7dcd38e8536e782aa3cb26c34e3 to your computer and use it in GitHub Desktop.
SmallestIntegerFinder.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SmallestIntegerFinder { | |
| findSmallestInt(args) { | |
| return args.sort(function(a, b) { | |
| return a - b; | |
| })[0]; | |
| } | |
| } | |
| //test | |
| Test.describe("Smallest Integer Tests", _ => { | |
| Test.it("Fixed Tests", __ => { | |
| var sif = new SmallestIntegerFinder(); | |
| Test.assertEquals(sif.findSmallestInt([78,56,232,12,8]),8,'Should return the smallest int 8'); | |
| Test.assertEquals(sif.findSmallestInt([78,56,232,12,18]),12,'Should return the smallest int 12'); | |
| Test.assertEquals(sif.findSmallestInt([78,56,232,412,228]),56,'Should return the smallest int 56'); | |
| Test.assertEquals(sif.findSmallestInt([78,56,232,12,0]),0,'Should return the smallest int 0'); | |
| Test.assertEquals(sif.findSmallestInt([1,56,232,12,8]),1,'Should return the smallest int 1'); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment