From 9b44b38c6a5199172aa2c4d2297954e170ac4308 Mon Sep 17 00:00:00 2001 From: dbv Date: Fri, 8 Jul 2016 18:03:17 +0300 Subject: [PATCH] Issue #1540: Added test case. --- src/ModelAPI/CMakeLists.txt | 3 ++- src/ModelAPI/Test/TestDoubleArray.py | 30 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/ModelAPI/Test/TestDoubleArray.py diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index ef618a982..1127806c7 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -132,4 +132,5 @@ ADD_UNIT_TESTS(TestConstants.py Test1064.py TestResults.py TestIntArray.py - Test1512.py) + Test1512.py + TestDoubleArray.py) diff --git a/src/ModelAPI/Test/TestDoubleArray.py b/src/ModelAPI/Test/TestDoubleArray.py new file mode 100644 index 000000000..88a1099c2 --- /dev/null +++ b/src/ModelAPI/Test/TestDoubleArray.py @@ -0,0 +1,30 @@ +#========================================================================= +# Initialization of the test +#========================================================================= +from ModelAPI import * +from GeomDataAPI import * +from GeomAlgoAPI import * +from GeomAPI import * + +import math + +aSession = ModelAPI_Session.get() + +#========================================================================= +# Test double array attribute +#========================================================================= +aPartSet = aSession.moduleDocument() +aSession.startOperation() +aSketchFeature = featureToCompositeFeature(aPartSet.addFeature("Sketch")) +aFeatureData = aSketchFeature.data() +anArray = aFeatureData.addAttribute("double_array", "DoubleArray") +aFeatureData.realArray("double_array").setSize(5) +assert(aFeatureData.realArray("double_array").size() == 5) +aFeatureData.realArray("double_array").setValue(0, 1) +assert(math.fabs(aFeatureData.realArray("double_array").value(0) - 1) < 10 ** -7) +aFeatureData.realArray("double_array").setValue(1, 1.5) +assert(math.fabs(aFeatureData.realArray("double_array").value(1) - 1.5) < 10 ** -7) + +#========================================================================= +# End of test +#========================================================================= -- 2.39.2