Sha256: e75179924a10ced19c7b64b42f7d5be4292a746a51c3cfa48540e17b924c77ae

Contents?: true

Size: 1.22 KB

Versions: 15

Compression:

Stored size: 1.22 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Apple Inc. and contributors.
// License:   Licened under MIT license (see license.js)
// ==========================================================================
/*globals module ok equals same test MyApp */

// test parsing of query string
var v = [];
module("SC.compare()", {
  setup: function() {
    // setup dummy data
    v[0]  = null;
    v[1]  = false;
    v[2]  = true;
    v[3]  = -12;
    v[4]  = 3.5;
    v[5]  = 'a string';
    v[6]  = 'another string';
    v[7]  = 'last string';
    v[8]  = [1,2];
    v[9]  = [1,2,3];
    v[10] = [1,3];
    v[11] = {a: 'hash'};
    v[12] = SC.Object.create();
    v[13] = function (a) {return a;};
  }
});


// ..........................................................
// TESTS
// 

test("ordering should work", function() {
  for (var j=0; j < v.length; j++) {
    equals(SC.compare(v[j],v[j]), 0, j +' should equal itself');
    for (var i=j+1; i < v.length; i++) {
      equals(SC.compare(v[j],v[i]), -1, 'v[' + j + '] (' + SC.typeOf(v[j]) + ') should be smaller than v[' + i + '] (' + SC.typeOf(v[i]) + ')' );
    }
    
  }
}); 
  

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sproutcore-1.0.1046 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1043 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1042 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1037 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1035 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1031 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1030 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1029 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1027 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1028 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1026 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1025 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1024 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1009 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js
sproutcore-1.0.1008 frameworks/sproutcore/frameworks/runtime/tests/core/compare.js