Sha256: 9b47ad9aed024ca7e9505d7d95d8f9805200ab00b4b1e5c5b1f21504db4b9882

Contents?: true

Size: 1.46 KB

Versions: 41

Compression:

Stored size: 1.46 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 Apple Inc. and contributors.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================

/*global module test equals context ok same notest */

module("SC.IndexSet#max");

test("newly created index", function() {
  var set = SC.IndexSet.create();
  equals(set.get('max'), 0, 'max should be 0');
});

test("after adding one range", function() {
  var set = SC.IndexSet.create().add(4,2);
  equals(set.get('max'),6, 'max should be one greater than max index');
});

test("after adding range then removing part of range", function() {
  var set = SC.IndexSet.create().add(4,4).remove(6,4);
  equals(set.get('max'),6, 'max should be one greater than max index');
});

test("after adding range several disjoint ranges", function() {
  var set = SC.IndexSet.create().add(4,4).add(6000);
  equals(set.get('max'),6001, 'max should be one greater than max index');
});

test("after removing disjoint range", function() {
  var set = SC.IndexSet.create().add(4,2).add(6000).remove(5998,10);
  equals(set.get('max'),6, 'max should be one greater than max index');
});

test("after removing all ranges", function() {
  var set = SC.IndexSet.create().add(4,2).add(6000).remove(3,6200);
  equals(set.get('max'), 0, 'max should be back to 0 with no content');
});

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
sproutcore-1.6.0.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.rc.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.rc.2 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.rc.2-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.rc.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.rc.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.rc.1-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.beta.3-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.beta.3-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.beta.3 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.beta.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.beta.2-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.beta.2 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.6.0.beta.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.5.0-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.5.0 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js
sproutcore-1.5.0.rc.2 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js