Permalink
Browse files

Refactor Jasmine matchers.

toEqualArray and toEqualProperties are now handled by toEqual.
toEqualArrayEpsilon is now handled by toEqualEpsilon.
Typed arrays are now considered the same as regular JS arrays for equality purposes.
toBeIn now uses the same definition of equality that isEqual does.
  • Loading branch information...
1 parent 4c48259 commit 6c31ee4a73f51811ca69df8eac6c979bcf1d600b @shunter shunter committed Jul 25, 2012
Showing with 559 additions and 556 deletions.
  1. +1 −1 Specs/Core/HermitePolynomialApproximationSpec.js
  2. +1 −1 Specs/Core/LagrangePolynomialApproximationSpec.js
  3. +2 −2 Specs/Core/Matrix2Spec.js
  4. +2 −2 Specs/Core/Matrix3Spec.js
  5. +2 −2 Specs/Core/Matrix4Spec.js
  6. +2 −2 Specs/Core/MeshFiltersSpec.js
  7. +1 −1 Specs/Core/PlaneTessellatorSpec.js
  8. +6 −6 Specs/Core/PolygonPipelineSpec.js
  9. +2 −2 Specs/DynamicScene/CzmlCartesian2Spec.js
  10. +2 −2 Specs/DynamicScene/CzmlCartesian3Spec.js
  11. +4 −4 Specs/DynamicScene/CzmlCartographicSpec.js
  12. +4 −4 Specs/DynamicScene/CzmlColorSpec.js
  13. +2 −2 Specs/DynamicScene/CzmlNumberSpec.js
  14. +2 −2 Specs/DynamicScene/CzmlUnitCartesian3Spec.js
  15. +2 −2 Specs/DynamicScene/CzmlUnitQuaternionSpec.js
  16. +2 −2 Specs/DynamicScene/CzmlUnitSphericalSpec.js
  17. +2 −2 Specs/DynamicScene/DynamicBillboardVisualizerSpec.js
  18. +4 −4 Specs/DynamicScene/DynamicLabelVisualizerSpec.js
  19. +2 −2 Specs/DynamicScene/DynamicPointVisualizerSpec.js
  20. +2 −2 Specs/DynamicScene/DynamicPolylineVisualizerSpec.js
  21. +10 −10 Specs/DynamicScene/DynamicPropertySpec.js
  22. +2 −2 Specs/DynamicScene/DynamicPyramidSpec.js
  23. +2 −2 Specs/Renderer/AutomaticUniformSpec.js
  24. +2 −2 Specs/Renderer/BuiltinFunctionsSpec.js
  25. +11 −11 Specs/Renderer/ClearSpec.js
  26. +57 −57 Specs/Renderer/ConstructiveSolidGeometrySpec.js
  27. +2 −2 Specs/Renderer/ContextSpec.js
  28. +38 −38 Specs/Renderer/CubeMapSpec.js
  29. +52 −52 Specs/Renderer/DrawSpec.js
  30. +15 −15 Specs/Renderer/FramebufferSpec.js
  31. +33 −33 Specs/Renderer/RaySpec.js
  32. +30 −30 Specs/Renderer/ShaderProgramSpec.js
  33. +1 −1 Specs/Renderer/TextureAtlasBuilderSpec.js
  34. +28 −28 Specs/Renderer/TextureAtlasSpec.js
  35. +18 −18 Specs/Renderer/TextureSpec.js
  36. +10 −10 Specs/Renderer/VertexArrayFactorySpec.js
  37. +4 −4 Specs/Renderer/VertexArraySpec.js
  38. +61 −61 Specs/Scene/BillboardCollectionSpec.js
  39. +12 −12 Specs/Scene/CompositePrimitiveSpec.js
  40. +41 −41 Specs/Scene/LabelCollectionSpec.js
  41. +12 −12 Specs/Scene/PolygonSpec.js
  42. +7 −7 Specs/Scene/PolylineSpec.js
  43. +63 −60 Specs/addDefaultMatchers.js
  44. +1 −1 Specs/renderFragment.js
@@ -49,7 +49,7 @@ defineSuite([
var x = 100.0;
var result = HermitePolynomialApproximation.interpolateOrderZero(x, xTable, yTableCombined, 2);
var expectedResult = [13379311.51716268, 92.73903788149451];
- expect(result).toEqualArrayEpsilon(expectedResult, 1e-15);
+ expect(result).toEqualEpsilon(expectedResult, 1e-15);
});
it('getRequiredDataPoints should be 1 more than degree, except for 0, which requires 2', function() {
@@ -25,7 +25,7 @@ defineSuite([
var x = 100.0;
var result = LagrangePolynomialApproximation.interpolateOrderZero(x, xTable, yTable, 3);
var expectedResult = [13367002.870928623, 545695.7388100647, 0];
- expect(result).toEqualArrayEpsilon(expectedResult, 1e-15);
+ expect(result).toEqualEpsilon(expectedResult, 1e-15);
});
it('getRequiredDataPoints should be 1 more than degree, except for 0, which requires 2', function() {
@@ -73,7 +73,7 @@ defineSuite([
var expected = [1.0, 2.0, 3.0, 4.0];
var returnedResult = Matrix2.fromColumnMajorArray(expected).toArray();
expect(returnedResult).toNotBe(expected);
- expect(returnedResult).toEqualArray(expected);
+ expect(returnedResult).toEqual(expected);
});
it('toArray works with a result parameter', function() {
@@ -82,7 +82,7 @@ defineSuite([
var returnedResult = Matrix2.fromColumnMajorArray(expected).toArray(result);
expect(returnedResult).toBe(result);
expect(returnedResult).toNotBe(expected);
- expect(returnedResult).toEqualArray(expected);
+ expect(returnedResult).toEqual(expected);
});
it('getColumn works without a result parameter', function() {
@@ -116,7 +116,7 @@ defineSuite([
var expected = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0];
var returnedResult = Matrix3.fromColumnMajorArray(expected).toArray();
expect(returnedResult).toNotBe(expected);
- expect(returnedResult).toEqualArray(expected);
+ expect(returnedResult).toEqual(expected);
});
it('toArray works with a result parameter', function() {
@@ -125,7 +125,7 @@ defineSuite([
var returnedResult = Matrix3.fromColumnMajorArray(expected).toArray(result);
expect(returnedResult).toBe(result);
expect(returnedResult).toNotBe(expected);
- expect(returnedResult).toEqualArray(expected);
+ expect(returnedResult).toEqual(expected);
});
it('getColumn works without a result parameter', function() {
@@ -247,7 +247,7 @@ defineSuite([
var expected = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0];
var returnedResult = Matrix4.fromColumnMajorArray(expected).toArray();
expect(returnedResult).toNotBe(expected);
- expect(returnedResult).toEqualArray(expected);
+ expect(returnedResult).toEqual(expected);
});
it('toArray works with a result parameter', function() {
@@ -256,7 +256,7 @@ defineSuite([
var returnedResult = Matrix4.fromColumnMajorArray(expected).toArray(result);
expect(returnedResult).toBe(result);
expect(returnedResult).toNotBe(expected);
- expect(returnedResult).toEqualArray(expected);
+ expect(returnedResult).toEqual(expected);
});
it('getColumn works without a result parameter', function() {
@@ -303,10 +303,10 @@ defineSuite([
expect(meshes.length).toEqual(1);
expect(meshes[0].attributes.time.componentDatatype).toEqual(ComponentDatatype.FLOAT);
expect(meshes[0].attributes.time.componentsPerAttribute).toEqual(1);
- expect(meshes[0].attributes.time.values).toEqualArray([0, sixtyFourK]);
+ expect(meshes[0].attributes.time.values).toEqual([0, sixtyFourK]);
expect(meshes[0].indexLists[0].primitiveType).toEqual(PrimitiveType.TRIANGLES);
- expect(meshes[0].indexLists[0].values).toEqualArray([0, 0, 0, 1, 1, 1, 0, 1, 0]);
+ expect(meshes[0].indexLists[0].values).toEqual([0, 0, 0, 1, 1, 1, 0, 1, 0]);
});
it('fitToUnsignedShortIndices creates two meshes', function() {
@@ -35,7 +35,7 @@ defineSuite(['Core/PlaneTessellator'], function(PlaneTessellator) {
}
});
- expect(callbacks).toEqualArray([{
+ expect(callbacks).toEqual([{
x : 0.0,
y : 0.0
}, {
@@ -26,7 +26,7 @@ defineSuite([
new Cartesian3(3.0, 3.0, 3.0)
]);
- expect(positions).toEqualArray([
+ expect(positions).toEqual([
new Cartesian3(1.0, 1.0, 1.0),
new Cartesian3(2.0, 2.0, 2.0),
new Cartesian3(3.0, 3.0, 3.0)
@@ -41,7 +41,7 @@ defineSuite([
new Cartesian3(1.0, 1.0, 1.0)
]);
- expect(positions).toEqualArray([
+ expect(positions).toEqual([
new Cartesian3(2.0, 2.0, 2.0),
new Cartesian3(3.0, 3.0, 3.0),
new Cartesian3(1.0, 1.0, 1.0)
@@ -174,21 +174,21 @@ defineSuite([
it('earClip2D triangulates a triangle', function() {
var indices = PolygonPipeline.earClip2D([new Cartesian2(0.0, 0.0), new Cartesian2(1.0, 0.0), new Cartesian2(0.0, 1.0)]);
- expect(indices).toEqualArray([0, 1, 2]);
+ expect(indices).toEqual([0, 1, 2]);
});
it('earClip2D triangulates a square', function() {
var indices = PolygonPipeline.earClip2D([new Cartesian2(0.0, 0.0), new Cartesian2(1.0, 0.0), new Cartesian2(1.0, 1.0), new Cartesian2(0.0, 1.0)]);
- expect(indices).toEqualArray([0, 1, 2, 0, 2, 3]);
+ expect(indices).toEqual([0, 1, 2, 0, 2, 3]);
});
it('earClip2D triangulates simple concave', function() {
var positions = [new Cartesian2(0.0, 0.0), new Cartesian2(2.0, 0.0), new Cartesian2(2.0, 2.0), new Cartesian2(1.0, 0.25), new Cartesian2(0.0, 2.0)];
var indices = PolygonPipeline.earClip2D(positions);
- expect(indices).toEqualArray([1, 2, 3, 3, 4, 0, 0, 1, 3]);
+ expect(indices).toEqual([1, 2, 3, 3, 4, 0, 0, 1, 3]);
});
it('earClip2D triangulates complex concave', function() {
@@ -197,7 +197,7 @@ defineSuite([
var indices = PolygonPipeline.earClip2D(positions);
- expect(indices).toEqualArray([3, 4, 5, 3, 5, 6, 3, 6, 7, 7, 0, 1, 7, 1, 2, 2, 3, 7]);
+ expect(indices).toEqual([3, 4, 5, 3, 5, 6, 3, 6, 7, 7, 0, 1, 7, 1, 2, 2, 3, 7]);
});
it('earClip2D throws without positions', function() {
@@ -20,8 +20,8 @@ defineSuite([
};
it('unwrapInterval', function() {
- expect(CzmlCartesian2.unwrapInterval(constantCartesianInterval)).toEqualArray(constantCartesianInterval.cartesian2);
- expect(CzmlCartesian2.unwrapInterval(sampledCartesianInterval)).toEqualArray(sampledCartesianInterval.cartesian2);
+ expect(CzmlCartesian2.unwrapInterval(constantCartesianInterval)).toEqual(constantCartesianInterval.cartesian2);
+ expect(CzmlCartesian2.unwrapInterval(sampledCartesianInterval)).toEqual(sampledCartesianInterval.cartesian2);
});
it('isSampled', function() {
@@ -20,8 +20,8 @@ defineSuite([
};
it('unwrapInterval', function() {
- expect(CzmlCartesian3.unwrapInterval(constantCartesianInterval)).toEqualArray(constantCartesianInterval.cartesian);
- expect(CzmlCartesian3.unwrapInterval(sampledCartesianInterval)).toEqualArray(sampledCartesianInterval.cartesian);
+ expect(CzmlCartesian3.unwrapInterval(constantCartesianInterval)).toEqual(constantCartesianInterval.cartesian);
+ expect(CzmlCartesian3.unwrapInterval(sampledCartesianInterval)).toEqual(sampledCartesianInterval.cartesian);
});
it('isSampled', function() {
@@ -31,10 +31,10 @@ defineSuite([
};
it('unwrapInterval', function() {
- expect(CzmlCartographic.unwrapInterval(constantCartographicInterval)).toEqualArray(constantCartographicInterval.cartographicRadians);
- expect(CzmlCartographic.unwrapInterval(constantCartographicDegreesInterval)).toEqualArray(constantCartographicInterval.cartographicRadians);
- expect(CzmlCartographic.unwrapInterval(sampledCartographicInterval)).toEqualArray(sampledCartographicInterval.cartographicRadians);
- expect(CzmlCartographic.unwrapInterval(sampledCartographicDegreesInterval)).toEqualArray(sampledCartographicInterval.cartographicRadians);
+ expect(CzmlCartographic.unwrapInterval(constantCartographicInterval)).toEqual(constantCartographicInterval.cartographicRadians);
+ expect(CzmlCartographic.unwrapInterval(constantCartographicDegreesInterval)).toEqual(constantCartographicInterval.cartographicRadians);
+ expect(CzmlCartographic.unwrapInterval(sampledCartographicInterval)).toEqual(sampledCartographicInterval.cartographicRadians);
+ expect(CzmlCartographic.unwrapInterval(sampledCartographicDegreesInterval)).toEqual(sampledCartographicInterval.cartographicRadians);
});
it('isSampled', function() {
@@ -28,10 +28,10 @@ defineSuite([
var color2 = new Color(sampledRgbafInterval.rgbaf[6], sampledRgbafInterval.rgbaf[7], sampledRgbafInterval.rgbaf[8], sampledRgbafInterval.rgbaf[9]);
it('unwrapInterval', function() {
- expect(CzmlColor.unwrapInterval(constantRgbaInterval)).toEqualArray(constantRgbafInterval.rgbaf);
- expect(CzmlColor.unwrapInterval(constantRgbafInterval)).toEqualArray(constantRgbafInterval.rgbaf);
- expect(CzmlColor.unwrapInterval(sampledRgbaInterval)).toEqualArray(sampledRgbafInterval.rgbaf);
- expect(CzmlColor.unwrapInterval(sampledRgbafInterval)).toEqualArray(sampledRgbafInterval.rgbaf);
+ expect(CzmlColor.unwrapInterval(constantRgbaInterval)).toEqual(constantRgbafInterval.rgbaf);
+ expect(CzmlColor.unwrapInterval(constantRgbafInterval)).toEqual(constantRgbafInterval.rgbaf);
+ expect(CzmlColor.unwrapInterval(sampledRgbaInterval)).toEqual(sampledRgbafInterval.rgbaf);
+ expect(CzmlColor.unwrapInterval(sampledRgbafInterval)).toEqual(sampledRgbafInterval.rgbaf);
});
it('isSampled', function() {
@@ -13,8 +13,8 @@ defineSuite([
};
it('unwrapInterval', function() {
- expect(CzmlNumber.unwrapInterval(simpleNumber)).toEqualArray(simpleNumber);
- expect(CzmlNumber.unwrapInterval(sampledNumberInterval)).toEqualArray(sampledNumberInterval.number);
+ expect(CzmlNumber.unwrapInterval(simpleNumber)).toEqual(simpleNumber);
+ expect(CzmlNumber.unwrapInterval(sampledNumberInterval)).toEqual(sampledNumberInterval.number);
});
it('isSampled', function() {
@@ -22,8 +22,8 @@ defineSuite([
};
it('unwrapInterval', function() {
- expect(CzmlUnitCartesian3.unwrapInterval(constantCartesianInterval)).toEqualArray(constantCartesianInterval.unitCartesian);
- expect(CzmlUnitCartesian3.unwrapInterval(sampledCartesianInterval)).toEqualArray(sampledCartesianInterval.unitCartesian);
+ expect(CzmlUnitCartesian3.unwrapInterval(constantCartesianInterval)).toEqual(constantCartesianInterval.unitCartesian);
+ expect(CzmlUnitCartesian3.unwrapInterval(sampledCartesianInterval)).toEqual(sampledCartesianInterval.unitCartesian);
});
it('isSampled', function() {
@@ -22,8 +22,8 @@ defineSuite([
};
it('unwrapInterval', function() {
- expect(CzmlUnitQuaternion.unwrapInterval(constantQuaternionInterval)).toEqualArray(constantQuaternionInterval.unitQuaternion);
- expect(CzmlUnitQuaternion.unwrapInterval(sampledQuaternionInterval)).toEqualArray(sampledQuaternionInterval.unitQuaternion);
+ expect(CzmlUnitQuaternion.unwrapInterval(constantQuaternionInterval)).toEqual(constantQuaternionInterval.unitQuaternion);
+ expect(CzmlUnitQuaternion.unwrapInterval(sampledQuaternionInterval)).toEqual(sampledQuaternionInterval.unitQuaternion);
});
it('isSampled', function() {
@@ -22,8 +22,8 @@ defineSuite([
};
it('unwrapInterval', function() {
- expect(CzmlUnitSpherical.unwrapInterval(constantSphericalInterval)).toEqualArray(constantSphericalInterval.unitSpherical);
- expect(CzmlUnitSpherical.unwrapInterval(sampledSphericalInterval)).toEqualArray(sampledSphericalInterval.unitSpherical);
+ expect(CzmlUnitSpherical.unwrapInterval(constantSphericalInterval)).toEqual(constantSphericalInterval.unitSpherical);
+ expect(CzmlUnitSpherical.unwrapInterval(sampledSphericalInterval)).toEqual(sampledSphericalInterval.unitSpherical);
});
it('isSampled', function() {
@@ -155,7 +155,7 @@ defineSuite([
visualizer.update(time);
if (bb.getShow()) {
expect(bb.getPosition()).toEqual(testObject.position.getValueCartesian(time));
- expect(bb.getColor()).toEqualProperties(testObject.billboard.color.getValue(time));
+ expect(bb.getColor()).toEqual(testObject.billboard.color.getValue(time));
expect(bb.getEyeOffset()).toEqual(testObject.billboard.eyeOffset.getValue(time));
expect(bb.getScale()).toEqual(testObject.billboard.scale.getValue(time));
expect(bb.getHorizontalOrigin()).toEqual(testObject.billboard.horizontalOrigin.getValue(time));
@@ -182,7 +182,7 @@ defineSuite([
var imageReady = bb.getImageIndex() === 1; //true once the green image is loaded
if (imageReady) {
expect(bb.getPosition()).toEqual(testObject.position.getValueCartesian(time));
- expect(bb.getColor()).toEqualProperties(testObject.billboard.color.getValue(time));
+ expect(bb.getColor()).toEqual(testObject.billboard.color.getValue(time));
expect(bb.getEyeOffset()).toEqual(testObject.billboard.eyeOffset.getValue(time));
expect(bb.getScale()).toEqual(testObject.billboard.scale.getValue(time));
expect(bb.getHorizontalOrigin()).toEqual(testObject.billboard.horizontalOrigin.getValue(time));
@@ -160,8 +160,8 @@ defineSuite([
expect(l.getText()).toEqual(testObject.label.text.getValue(time));
expect(l.getFont()).toEqual(testObject.label.font.getValue(time));
expect(l.getStyle()).toEqual(testObject.label.style.getValue(time));
- expect(l.getFillColor()).toEqualProperties(testObject.label.fillColor.getValue(time));
- expect(l.getOutlineColor()).toEqualProperties(testObject.label.outlineColor.getValue(time));
+ expect(l.getFillColor()).toEqual(testObject.label.fillColor.getValue(time));
+ expect(l.getOutlineColor()).toEqual(testObject.label.outlineColor.getValue(time));
expect(l.getHorizontalOrigin()).toEqual(testObject.label.horizontalOrigin.getValue(time));
expect(l.getVerticalOrigin()).toEqual(testObject.label.verticalOrigin.getValue(time));
expect(l.getEyeOffset()).toEqual(testObject.label.eyeOffset.getValue(time));
@@ -187,8 +187,8 @@ defineSuite([
expect(l.getText()).toEqual(testObject.label.text.getValue(time));
expect(l.getFont()).toEqual(testObject.label.font.getValue(time));
expect(l.getStyle()).toEqual(testObject.label.style.getValue(time));
- expect(l.getFillColor()).toEqualProperties(testObject.label.fillColor.getValue(time));
- expect(l.getOutlineColor()).toEqualProperties(testObject.label.outlineColor.getValue(time));
+ expect(l.getFillColor()).toEqual(testObject.label.fillColor.getValue(time));
+ expect(l.getOutlineColor()).toEqual(testObject.label.outlineColor.getValue(time));
expect(l.getHorizontalOrigin()).toEqual(testObject.label.horizontalOrigin.getValue(time));
expect(l.getVerticalOrigin()).toEqual(testObject.label.verticalOrigin.getValue(time));
expect(l.getEyeOffset()).toEqual(testObject.label.eyeOffset.getValue(time));
@@ -129,7 +129,7 @@ defineSuite([
visualizer.update(time);
expect(bb.getShow()).toEqual(testObject.point.show.getValue(time));
expect(bb.getPosition()).toEqual(testObject.position.getValueCartesian(time));
- expect(bb._visualizerColor).toEqualProperties(testObject.point.color.getValue(time));
+ expect(bb._visualizerColor).toEqual(testObject.point.color.getValue(time));
expect(bb._visualizerOutlineColor).toEqual(testObject.point.outlineColor.getValue(time));
expect(bb._visualizerOutlineWidth).toEqual(testObject.point.outlineWidth.getValue(time));
expect(bb._visualizerPixelSize).toEqual(testObject.point.pixelSize.getValue(time));
@@ -143,7 +143,7 @@ defineSuite([
visualizer.update(time);
expect(bb.getShow()).toEqual(testObject.point.show.getValue(time));
expect(bb.getPosition()).toEqual(testObject.position.getValueCartesian(time));
- expect(bb._visualizerColor).toEqualProperties(testObject.point.color.getValue(time));
+ expect(bb._visualizerColor).toEqual(testObject.point.color.getValue(time));
expect(bb._visualizerOutlineColor).toEqual(testObject.point.outlineColor.getValue(time));
expect(bb._visualizerOutlineWidth).toEqual(testObject.point.outlineWidth.getValue(time));
expect(bb._visualizerPixelSize).toEqual(testObject.point.pixelSize.getValue(time));
@@ -124,7 +124,7 @@ defineSuite([
visualizer.update(time);
expect(primitive.show).toEqual(testObject.polyline.show.getValue(time));
expect(primitive.getPositions()).toEqual(testObject.vertexPositions.getValueCartesian(time));
- expect(primitive.color).toEqualProperties(testObject.polyline.color.getValue(time));
+ expect(primitive.color).toEqual(testObject.polyline.color.getValue(time));
expect(primitive.outlineColor).toEqual(testObject.polyline.outlineColor.getValue(time));
expect(primitive.outlineWidth).toEqual(testObject.polyline.outlineWidth.getValue(time));
expect(primitive.width).toEqual(testObject.polyline.width.getValue(time));
@@ -138,7 +138,7 @@ defineSuite([
visualizer.update(time);
expect(primitive.show).toEqual(testObject.polyline.show.getValue(time));
expect(primitive.getPositions()).toEqual(testObject.vertexPositions.getValueCartesian(time));
- expect(primitive.color).toEqualProperties(testObject.polyline.color.getValue(time));
+ expect(primitive.color).toEqual(testObject.polyline.color.getValue(time));
expect(primitive.outlineColor).toEqual(testObject.polyline.outlineColor.getValue(time));
expect(primitive.outlineWidth).toEqual(testObject.polyline.outlineWidth.getValue(time));
expect(primitive.width).toEqual(testObject.polyline.width.getValue(time));
Oops, something went wrong.

0 comments on commit 6c31ee4

Please sign in to comment.