MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / test_signum

Function test_signum

maths/signum.py:39–52  ·  view source on GitHub ↗

Tests the signum function >>> test_signum()

()

Source from the content-addressed store, hash-verified

37
38
39def test_signum() -> None:
40 """
41 Tests the signum function
42 >>> test_signum()
43 """
44 assert signum(5) == 1
45 assert signum(-5) == -1
46 assert signum(0) == 0
47 assert signum(10.5) == 1
48 assert signum(-10.5) == -1
49 assert signum(1e-6) == 1
50 assert signum(-1e-6) == -1
51 assert signum(123456789) == 1
52 assert signum(-123456789) == -1
53
54
55if __name__ == "__main__":

Callers

nothing calls this directly

Calls 1

signumFunction · 0.85

Tested by

no test coverage detected