1
1
module Test.Main where
2
2
3
- import Prelude
4
- import Debug.Trace
5
- import Data.Either
6
- import Data.Maybe
3
+ import Prelude (Unit , negate , bind , ($), (==), (&&), (<$>))
4
+ import Data.Maybe (Maybe (..))
7
5
import Test.QuickCheck
8
- import Data.ArrayBuffer.Types
6
+ import Control.Monad.Eff (Eff )
7
+ import Control.Monad.Eff.Console (CONSOLE )
8
+ import Control.Monad.Eff.Random (RANDOM )
9
+ import Control.Monad.Eff.Exception (EXCEPTION )
9
10
import Data.ArrayBuffer.ArrayBuffer as AB
10
11
import Data.ArrayBuffer.DataView as DV
11
12
import Data.ArrayBuffer.Typed as TA
12
- import Data.ArrayBuffer.Show
13
- import Control.Monad.Eff
14
- import Control.Monad.Eff.Random
15
- import Control.Monad.Eff.Exception
16
- import Math
17
13
14
+ main :: Eff ( console :: CONSOLE , random :: RANDOM , err :: EXCEPTION ) Unit
18
15
main = do
19
16
let ab = AB .create 4
20
17
assert $ AB .byteLength ab == 4
@@ -39,9 +36,9 @@ main = do
39
36
assert $ (DV .byteLength <$> DV .slice 0 40 nab) == Nothing
40
37
41
38
assert $ do
42
- let ab = AB .fromArray [1.0 ,2.0 ,3.0 ,4.0 ]
43
- let dv = DV .whole ab
44
- let i8 = TA .asInt8Array dv
39
+ let ab' = AB .fromArray [1.0 ,2.0 ,3.0 ,4.0 ]
40
+ let dv' = DV .whole ab'
41
+ let i8 = TA .asInt8Array dv'
45
42
((Just 2.0 ) == i8 `TA.at` 1) && (Nothing == i8 `TA.at` 4) && (Nothing == i8 `TA.at` (-1 ))
46
43
47
44
assert $ [1.0 ,2.0 ,3.0 ] == (TA .toArray $ TA .asInt8Array $ DV .whole $ AB .fromArray [1.0 ,2.0 ,3.0 ])
0 commit comments