Sha256: ed35136d82885715ab959a4fb68a8520ebbeb19525012691c5cd3db6af1d7d55
Contents?: true
Size: 1.41 KB
Versions: 4
Compression:
Stored size: 1.41 KB
Contents
/*------------------------------------------------------------------------------------------------- - Project: sproutcore - - Copyright: ©2013 Matygo Educational Incorporated operating as Learndot - - Author: Joe Gaudet (joe@learndot.com) and contributors (see contributors.txt) - - License: Licensed under MIT license (see license.js) - -------------------------------------------------------------------------------------------------*/ /*globals module, test, start, stop, expect, ok, equals*/ module("Number#ordinal"); /** * Admitedly not exhaustive, but tests the numbers from 1-100 */ test("Properly Computes the Ordinal in english", function () { var sts = [1, 21, 31, 41, 51, 61, 71, 81, 91, 101], nds = [2, 22, 32, 42, 52, 62, 72, 82, 92, 102], rds = [3, 23, 33, 43, 53, 63, 73, 83, 93, 103]; sts.forEach(function (number) { equals(number.ordinal(), 'st'); }); nds.forEach(function (number) { equals(number.ordinal(), 'nd'); }); rds.forEach(function (number) { equals(number.ordinal(), 'rd'); }); var ths = []; for (var i = 0; i < 100; i++) { ths.push(i); } ths.removeObjects(sts); ths.removeObjects(nds); ths.removeObjects(rds); ths.forEach(function (number) { equals(number.ordinal(), 'th'); }); });
Version data entries
4 entries across 4 versions & 1 rubygems