@@ -26,7 +26,7 @@ runEngineTests host = do
26
26
runLocalMatFun eng
27
27
cosOfPi eng
28
28
testIsMNull eng
29
- testGetFirst eng
29
+ testGetFirstLast eng
30
30
testAbstractValueUse eng
31
31
testTypedAbstractValueUse eng
32
32
testGetByteStreamFromArray eng
@@ -60,23 +60,32 @@ testIsMNull eng = do
60
60
xa <- createMXScalar (1.0 :: MDouble )
61
61
let xaRes = assert (isMNull xa == False ) xa
62
62
xaResEi <- mxArrayGetFirst xaRes
63
- putStrLn $ " xaResEi is Right: " <> (show $ isRight xaResEi)
63
+ putStrLn $ " xaResEi is Right: " <> (show xaResEi)
64
64
xae :: MXArray MChar <- createMXArray []
65
65
freeMXArray xae
66
66
mxLen <- mxArrayLength xae
67
- putStrLn $ " length is " <> ( show mxLen)
68
- -- This is a bit surprising, but ok
67
+ mxDims <- mxArraySize xae
68
+ putStrLn $ " length is " <> ( show mxLen) <> " dims are " <> ( show $ mxDims)
69
69
let xaeRes = assert (isMNull xae == False ) xae
70
70
xaeResEi <- mxArrayGetFirst xaeRes
71
- putStrLn $ " xaeResEi is Right: " <> (show $ isRight xaeResEi)
72
-
73
- testGetFirst :: Engine -> IO ()
74
- testGetFirst eng = do
75
- putStrLn $ " \n -- testGetFirst --"
76
- xa <- createMXScalar (1.0 :: MDouble )
77
- xEi <- mxArrayGetFirst xa
78
- let xRes = assert (xEi == Right 1.0 ) xEi
71
+ putStrLn $ " xaeResEi is Left: " <> (show xaeResEi)
72
+
73
+ testGetFirstLast :: Engine -> IO ()
74
+ testGetFirstLast eng = do
75
+ putStrLn $ " \n -- testGetFirstLast --"
76
+ let testVal :: MDouble = 1.0
77
+ xa <- createMXScalar testVal
78
+ xfEi <- mxArrayGetFirst xa
79
+ xlEi <- mxArrayGetLast xa
80
+ let xRes = assert (xlEi == Right 1.0 && xfEi == xlEi) xfEi
79
81
putStrLn $ " xRes is : " <> (show xRes)
82
+ threeArray :: MXArray MDouble <- fromListIO [5.0 , 6.0 , 7.0 ]
83
+ txfEi <- mxArrayGetFirst threeArray
84
+ txlEi <- mxArrayGetLast threeArray
85
+ let txfRes = assert (txfEi == Right 5.0 ) txfEi
86
+ putStrLn $ " txfRes is : " <> (show txfRes)
87
+ let txlRes = assert (txlEi == Right 7.0 ) txlEi
88
+ putStrLn $ " txlRes is : " <> (show txlRes)
80
89
81
90
testAbstractValueUse :: Engine -> IO ()
82
91
testAbstractValueUse eng = do
0 commit comments