-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Valerii Butorin
committed
Apr 30, 2024
1 parent
9757aa0
commit 8c8f454
Showing
8 changed files
with
67 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ library: | |
size: 32 | ||
accum{x}: | ||
type: Accum | ||
isInt: true | ||
networks: | ||
net1: | ||
pus: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE IncoherentInstances #-} | ||
{-# LANGUAGE PartialTypeSignatures #-} | ||
|
||
{- | | ||
Module : NITTA.Model.Config.Tests | ||
Description : | ||
Copyright : (c) Valerii Butorin, 2024 | ||
License : BSD3 | ||
Maintainer : [email protected] | ||
Stability : experimental | ||
-} | ||
module NITTA.Model.Config.Tests ( | ||
tests, | ||
) where | ||
|
||
import Data.Maybe | ||
import Data.Map as M | ||
import Data.Text qualified as T | ||
import NITTA.Model.Microarchitecture.Config as Conf | ||
import Test.Tasty (testGroup) | ||
import Test.Tasty.HUnit | ||
|
||
tests = | ||
testGroup | ||
"Configuration parsing" | ||
[ testCase "parse config common" $ do | ||
conf <- parseConfig "examples/microarch.yml" | ||
let | ||
lib = fromJust $ library conf | ||
fram = fromJust $ M.lookup (T.pack "fram{x}") lib | ||
nets = networks conf | ||
net = fromJust $ M.lookup (T.pack "net1") nets | ||
spi = fromJust $ M.lookup (T.pack "spi") (fromJust $ pus net) | ||
proros_ = fromJust $ protos net | ||
shift = fromJust $ M.lookup (T.pack "shift{x}") proros_ | ||
div_ = fromJust $ M.lookup (T.pack "div{x}") proros_ | ||
|
||
"Sync" @=? show (ioSync conf) | ||
True @=? mock conf | ||
"fx32.32" @=? T.unpack (valueType conf) | ||
2 @=? M.size (fromJust $ library conf) | ||
|
||
32 @=? Conf.size fram | ||
Just True @=? Conf.sRight shift | ||
4 @=? Conf.pipeline div_ | ||
|
||
"mosi" @=? T.unpack (mosi spi) | ||
"miso" @=? T.unpack (miso spi) | ||
"sclk" @=? T.unpack (sclk spi) | ||
"cs" @=? T.unpack (cs spi) | ||
True @=? isSlave spi | ||
Just 6 @=? bufferSize spi | ||
0 @=? bounceFilter spi | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters