Fixed objc test runner and bezier test
Summary: - kill -9 SERVER_PID does not work for packager currently because it is started as daemon. - And lego tests just hang until they are killed e.g. intern/sandcastle/1952254070/187417721/ - fixed bezier test because it annoyed me with random breaks because of precision Reviewed By: davidaurelio Differential Revision: D3528588 fbshipit-source-id: 87e5b4330fa69bc9a8a7f48e2250f3c2239f2b35
This commit is contained in:
parent
c3f4d79475
commit
3ddf3db551
|
@ -5,13 +5,13 @@ var bezier = require('bezier');
|
|||
|
||||
var identity = function (x) { return x; };
|
||||
|
||||
function assertClose (a, b, precision) {
|
||||
expect(a).toBeCloseTo(b, 3);
|
||||
function assertClose (a, b, precision = 3) {
|
||||
expect(a).toBeCloseTo(b, precision);
|
||||
}
|
||||
|
||||
function makeAssertCloseWithPrecision (precision) {
|
||||
return function (a, b, message) {
|
||||
assertClose(a, b, message, precision);
|
||||
return function (a, b) {
|
||||
assertClose(a, b, precision);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ function allEquals (be1, be2, samples, assertion) {
|
|||
if (!assertion) assertion = assertClose;
|
||||
for (var i=0; i<=samples; ++i) {
|
||||
var x = i / samples;
|
||||
assertion(be1(x), be2(x), 'comparing '+be1+' and '+be2+' for value '+x);
|
||||
assertion(be1(x), be2(x));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ describe('bezier', function(){
|
|||
var easing = bezier(a, b, c, d);
|
||||
var projected = bezier(b, a, d, c);
|
||||
var composed = function (x) { return projected(easing(x)); };
|
||||
allEquals(identity, composed, 100, makeAssertCloseWithPrecision(0.05));
|
||||
allEquals(identity, composed, 100, makeAssertCloseWithPrecision(2));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -81,7 +81,7 @@ describe('bezier', function(){
|
|||
repeat(10)(function () {
|
||||
var a = Math.random(), b = 2*Math.random()-0.5, c = 1-a, d = 1-b;
|
||||
var easing = bezier(a, b, c, d);
|
||||
assertClose(easing(0.5), 0.5, easing+'(0.5) should be 0.5');
|
||||
assertClose(easing(0.5), 0.5);
|
||||
});
|
||||
});
|
||||
it('should be symetrical', function () {
|
||||
|
@ -89,7 +89,7 @@ describe('bezier', function(){
|
|||
var a = Math.random(), b = 2*Math.random()-0.5, c = 1-a, d = 1-b;
|
||||
var easing = bezier(a, b, c, d);
|
||||
var sym = function (x) { return 1 - easing(1-x); };
|
||||
allEquals(easing, sym, 100);
|
||||
allEquals(easing, sym, 100, makeAssertCloseWithPrecision(2));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,16 +16,11 @@ function cleanup {
|
|||
WATCHMAN_LOGS=/usr/local/Cellar/watchman/3.1/var/run/watchman/$USER.log
|
||||
[ -f $WATCHMAN_LOGS ] && cat $WATCHMAN_LOGS
|
||||
fi
|
||||
[ $SERVER_PID ] && kill -9 $SERVER_PID
|
||||
# kill whatever is occupying port 8081
|
||||
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$TRAVIS" ]; then
|
||||
# Run the packager process directly
|
||||
node ./local-cli/cli.js start &
|
||||
SERVER_PID=$!
|
||||
fi
|
||||
|
||||
XCODE_PROJECT="Examples/UIExplorer/UIExplorer.xcodeproj"
|
||||
XCODE_SCHEME="UIExplorer"
|
||||
XCODE_SDK="iphonesimulator"
|
||||
|
|
Loading…
Reference in New Issue