Famous / Famous/engine

Non-deterministic tests

Open
#364 3 comments 0 reactions 0 assignees View on GitHub
bug GL
Dominant language
JavaScript
Stars
1.7k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

Currently there are a couple of non-deterministic tests that should either be made deterministic, fixed or adjusted to log the generated random values.
## Example

``` js
t.test('GeometryHelper.normalizeVertices', function(t) {
var vertices = generateRandomArray(10, [-10, 10]);
var normalized = GeometryHelper.normalizeVertices(vertices);
var withinRange = testVector(normalized, function(vector) {
return (vector.x <= 1) && (vector.x >= -1)
&& (vector.y <= 1) && (vector.y >= -1)
&& (vector.z <= 1) && (vector.z >= -1);
});

t.ok(withinRange, "All vectors should be within 2x2 bounding box");
t.end();
});
```

in `GeometryHelper.spec.js`

The issue is `var vertices = generateRandomArray(10, [-10, 10])`. Sometimes it returns an array that makes the test fail, sometimes it doesn't (in which case we don't know about the values that made it fail). I've seen this before, but wasn't sure it was actually related to this test, but it seems to be the case. E.g. I'm specifically talking about the following CI build that passes on 0.10, but fails on iojs: https://travis-ci.org/Famous/engine/builds/68386307

@michaelobriena How do you want to proceed with this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.