Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
Revert swig version back to 3.0.2 and add test checking network param…
Browse files Browse the repository at this point in the history
…eters
  • Loading branch information
lscheinkman committed Mar 19, 2018
1 parent 4ffbadb commit 9f10533
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 9 deletions.
38 changes: 35 additions & 3 deletions bindings/py/tests/network_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def getSpec(cls):
"isDefaultInput": False,
"required": False,
"count": 0
},
},
},
"outputs": {
"UInt32": {
Expand All @@ -82,7 +82,7 @@ def getSpec(cls):
"isDefaultOutput": False,
"required": False,
"count": 0
},
},
},
"parameters": { }
}
Expand Down Expand Up @@ -177,4 +177,36 @@ def testNetworkLinkTypeValidation(self):
network.link("from", "to", "UniformLink", "", "Real32", "UInt32")
with pytest.raises(RuntimeError):
network.link("from", "to", "UniformLink", "", "UInt32", "Real32")


def testParameters(self):

n = engine.Network()
l1 = n.addRegion("l1", "TestNode", "")
scalars = [
("int32Param", l1.getParameterInt32, l1.setParameterInt32, 32, int, 35),
("uint32Param", l1.getParameterUInt32, l1.setParameterUInt32, 33, int, 36),
("int64Param", l1.getParameterInt64, l1.setParameterInt64, 64, long, 74),
("uint64Param", l1.getParameterUInt64, l1.setParameterUInt64, 65, long, 75),
("real32Param", l1.getParameterReal32, l1.setParameterReal32, 32.1, float, 33.1),
("real64Param", l1.getParameterReal64, l1.setParameterReal64, 64.1, float, 65.1),
("stringParam", l1.getParameterString, l1.setParameterString, "nodespec value", str, "new value")]

for paramName, paramGetFunc, paramSetFunc, initval, paramtype, newval in scalars:
# Check the initial value for each parameter.
x = paramGetFunc(paramName)
self.assertEqual(type(x), paramtype, paramName)
if initval is None:
continue
if type(x) == float:
self.assertTrue(abs(x - initval) < 0.00001, paramName)
else:
self.assertEqual(x, initval, paramName)

# Now set the value, and check to make sure the value is updated
paramSetFunc(paramName, newval)
x = paramGetFunc(paramName)
self.assertEqual(type(x), paramtype)
if type(x) == float:
self.assertTrue(abs(x - newval) < 0.00001)
else:
self.assertEqual(x, newval)
5 changes: 2 additions & 3 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ test:
# connections_performance_test disabled for build speed reasons (Takes over a minute to run)
# cd build/release/bin && ./connections_performance_test
# main unit tests
- build/release/bin/unit_tests --gtest_output=xml:build/artifacts/unit_tests_report.xml
- build/release/bin/unit_tests --gtest_output=xml:$CIRCLE_TEST_REPORTS/unit_tests_report.xml
post:
# We want to have the test report and wheel in both Circle_Artifacts as
# well as dist, for the sake of debugging
- cp build/artifacts/unit_tests_report.xml dist/
- cp build/artifacts/unit_tests_report.xml $CIRCLE_ARTIFACTS/
- cp $CIRCLE_TEST_REPORTS/unit_tests_report.xml $CIRCLE_ARTIFACTS/
- cp dist/*.whl $CIRCLE_ARTIFACTS/
# If not on a fork, upload artifacts to S3
- if [[ "$CIRCLE_REPOSITORY_URL" == "https://github.com/numenta/nupic.core" ]]; then ci/circle/deploy_s3-osx.sh; else echo "Skipping deployment, as this is a fork"; fi
6 changes: 3 additions & 3 deletions external/Swig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
# SWIG_DIR: the directory where swig is installed (.i files, etc.) as defined
# by FindSWIG.

set(swig_path "${REPOSITORY_DIR}/external/common/src/swig-3.0.12.tar.gz")
set(swigwin_path "${REPOSITORY_DIR}/external/common/src/swigwin-3.0.12.zip")
set(swig_path "${REPOSITORY_DIR}/external/common/src/swig-3.0.2.tar.gz")
set(swigwin_path "${REPOSITORY_DIR}/external/common/src/swigwin-3.0.2.zip")
set(pcre_path "${REPOSITORY_DIR}/external/common/src/pcre-8.37.tar.gz")

if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
Expand Down Expand Up @@ -56,7 +56,7 @@ else()
${EP_BASE}/Source/Swig/configure --prefix=${EP_BASE}/Install --disable-ccache --enable-cpp11-testing
)
set(swig_executable ${EP_BASE}/Install/bin/swig)
set(swig_dir ${EP_BASE}/Install/share/swig/3.0.12)
set(swig_dir ${EP_BASE}/Install/share/swig/3.0.2)
endif()

set(SWIG_EXECUTABLE ${swig_executable} PARENT_SCOPE)
Expand Down
Binary file added external/common/src/swig-3.0.2.tar.gz
Binary file not shown.
Binary file removed external/common/src/swigwin-3.0.12.zip
Binary file not shown.
Binary file not shown.

0 comments on commit 9f10533

Please sign in to comment.