MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / test_reduce

Function test_reduce

tests/python/test_arrays.py:1394–1403  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1392
1393
1394def test_reduce():
1395 items = [1, 2, 3, 4, 5]
1396 result = [None]
1397 pm.eval("""
1398 (result, arr) => {
1399 result[0] = arr.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
1400 }
1401 """)(result, items)
1402 assert items == [1, 2, 3, 4, 5]
1403 assert result[0] == 15
1404
1405
1406def test_reduce_empty_array_no_accumulator():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected