15832144755
2022-01-06 7b4c8991dca9cf2a809a95e239d144697d3afb56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { subdivideArray } from "../../Source/Cesium.js";
 
describe("Core/subdivideArray", function () {
  it("Splits evenly divided arrays", function () {
    var values = [1, 2, 3, 4];
    var splitValues = subdivideArray(values, 4);
    expect(splitValues.length).toEqual(4);
    expect(splitValues[0]).toEqual([1]);
    expect(splitValues[1]).toEqual([2]);
    expect(splitValues[2]).toEqual([3]);
    expect(splitValues[3]).toEqual([4]);
  });
 
  it("Splits unevenly divided arrays", function () {
    var values = [1, 2, 3, 4, 5, 6];
    var splitValues = subdivideArray(values, 4);
    expect(splitValues.length).toEqual(4);
    expect(splitValues[0]).toEqual([1, 2]);
    expect(splitValues[1]).toEqual([3, 4]);
    expect(splitValues[2]).toEqual([5]);
    expect(splitValues[3]).toEqual([6]);
  });
 
  it("Works with empty arrays", function () {
    var splitValues = subdivideArray([], 4);
    expect(splitValues.length).toEqual(0);
  });
 
  it("Throws with undefined array", function () {
    expect(function () {
      subdivideArray(undefined, 8);
    }).toThrowDeveloperError();
  });
 
  it("Throws with invalid number of arrays", function () {
    expect(function () {
      subdivideArray([], -1);
    }).toThrowDeveloperError();
  });
});