Git模块https://github.com/eugenioclrc/agar.io-clone
> gulp run
[14:50:54] Using gulpfile C:\....\gulpfile.js
[14:50:54] Starting 'lint'...
[14:50:54] Starting 'move-client'...
[14:50:57] Finished 'move-client' after 2.84 s
[14:50:57] Finished 'lint' after 2.88 s
[14:50:57] Starting 'build-client'...
[14:50:57] Starting 'build-server'...
[14:50:57] Starting 'test'...
[14:50:57] Finished 'test' after 2.21 ms
util.js
#massToRadius
V should return non-zero radius on zero input
V should convert masses to a circle radius
[14:50:58] Finished 'build-server' after 848 ms
#validNick
V should allow empty player nicknames
V should allow ascii character nicknames
V should disallow unicode-dependent alphabets
V should disallow spaces in nicknames
#log
1) should compute the log_{base} of a number
#getDistance
V should return a positive number
7 passing (390ms)
1 failing
1) util.js #log should compute the log_{base} of a number:
AssertionError: expected 2.0000000000000004 to deeply equal 2
+ expected - actual
-2.0000000000000004
+2发布于 2018-02-28 13:25:37
问题是您的节点版本,我认为。
创建这样的文件
// log-check.js
// from https://github.com/eugenioclrc/agar.io-clone/blob/master/src/server/lib/util.js
function multibaselog(n, base) {
return Math.log(n) / (base ? Math.log(base) : 1);
}
const log93 = multibaselog(9,3)
console.log(log93)
console.log(log93 === 2);然后用节点4尝试它。
$ nvm use 4
$ node log-check.js
2
true(工程)
然后在节点8中进行尝试。
$ nvm use 8
$ node log-check.js
2.0000000000000004
false(否)
如果您切换到较早版本的节点,我认为此测试将通过。
https://stackoverflow.com/questions/49030262
复制相似问题