Skip to content

Commit

Permalink
added a few more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andim committed May 23, 2017
1 parent d26ce39 commit 2ee8f9c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions noisyopt/tests/test_noisyopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ def callback(x):
res = noisyopt.minimizeCompass(quadratic, np.asarray([0.5, 1.0]), deltatol=deltatol,
errorcontrol=False, callback=callback)

# test with scaling
res = noisyopt.minimizeCompass(quadratic, np.asarray([0.5, 1.0]), deltatol=deltatol,
scaling=np.array([0.1, 1.0]),
errorcontrol=False)
npt.assert_allclose(res.x, [0.0, 0.0], atol=deltatol)

# test with output
res = noisyopt.minimizeCompass(quadratic, np.asarray([0.5, 1.0]), deltatol=deltatol,
errorcontrol=False, disp=True)
Expand Down Expand Up @@ -224,6 +230,11 @@ def test_DifferenceFunction():
difffunc = noisyopt.DifferenceFunction(lambda x: x+1, lambda x: x+2)
d, dse = difffunc(0)
assert d == -1.0
d, dse = difffunc(1)
assert d == -1.0
# again with same value to test caching
d, dse = difffunc(0)
assert d == -1.0

def test_memoized():
# memoize simple function
Expand Down

0 comments on commit 2ee8f9c

Please sign in to comment.