File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ module Foreign.Matlab.Array (
32
32
mxArrayGetList , mxArraySetList ,
33
33
mxArrayGetAll , mxArraySetAll , mxArrayGetFirst ,
34
34
fromListIO , cellFromListsIO ,
35
+ isMNull ,
35
36
36
37
-- * Struct access
37
38
-- | Structs in Matlab are always arrays, and so can be accessed using most array accessors.
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ runEngineTests host = do
25
25
addpath eng testPath
26
26
runLocalMatFun eng
27
27
cosOfPi eng
28
+ testIsMNull eng
28
29
testGetFirst eng
29
30
testAbstractValueUse eng
30
31
testTypedAbstractValueUse eng
@@ -53,6 +54,22 @@ cosBody eng cosFun x = do
53
54
y <- mxScalarGet y
54
55
print (y :: MDouble )
55
56
57
+ testIsMNull :: Engine -> IO ()
58
+ testIsMNull eng = do
59
+ putStrLn $ " \n -- testIsMNull --"
60
+ xa <- createMXScalar (1.0 :: MDouble )
61
+ let xaRes = assert (isMNull xa == False ) xa
62
+ xaResEi <- mxArrayGetFirst xaRes
63
+ putStrLn $ " xaResEi is Right: " <> (show $ isRight xaResEi)
64
+ xae :: MXArray MChar <- createMXArray []
65
+ freeMXArray xae
66
+ mxLen <- mxArrayLength xae
67
+ putStrLn $ " length is " <> (show mxLen)
68
+ -- This is a bit surprising, but ok
69
+ let xaeRes = assert (isMNull xae == False ) xae
70
+ xaeResEi <- mxArrayGetFirst xaeRes
71
+ putStrLn $ " xaeResEi is Right: " <> (show $ isRight xaeResEi)
72
+
56
73
testGetFirst :: Engine -> IO ()
57
74
testGetFirst eng = do
58
75
putStrLn $ " \n -- testGetFirst --"
You can’t perform that action at this time.
0 commit comments