Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-igraph
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-igraph
Commits
b3220726
Commit
b3220726
authored
Jun 05, 2015
by
Kai Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests
parent
62fb8045
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
0 deletions
+48
-0
Basic.hs
tests/Test/Basic.hs
+28
-0
Utils.hs
tests/Test/Utils.hs
+13
-0
test.hs
tests/test.hs
+7
-0
No files found.
tests/Test/Basic.hs
0 → 100644
View file @
b3220726
module
Test.Basic
(
tests
)
where
import
Test.Tasty
import
Test.Tasty.HUnit
import
Test.Utils
import
System.IO.Unsafe
import
Data.List
import
IGraph
tests
::
TestTree
tests
=
testGroup
"Basic tests"
[
graphCreation
]
graphCreation
::
TestTree
graphCreation
=
testGroup
"Graph creation"
[
testCase
""
$
assertBool
""
$
nNodes
simple
==
3
&&
nEdges
simple
==
3
,
testCase
""
$
[(
0
,
1
),(
1
,
2
),(
2
,
0
)]
@=?
(
sort
$
edges
simple
)
,
testCase
""
$
assertBool
""
$
nNodes
gr
==
100
&&
nEdges
gr
==
1000
,
testCase
""
$
edgeList
@=?
(
sort
$
edges
gr
)
]
where
edgeList
=
sort
$
unsafePerformIO
$
randEdges
1000
100
gr
=
mkGraph
(
100
,
Nothing
)
(
edgeList
,
Nothing
)
::
LGraph
D
()
()
simple
=
mkGraph
(
3
,
Nothing
)
([(
0
,
1
),(
1
,
2
),(
2
,
0
)],
Nothing
)
::
LGraph
D
()
()
tests/Test/Utils.hs
0 → 100644
View file @
b3220726
module
Test.Utils
where
import
Control.Monad
import
System.Random
import
Data.List
randEdges
::
Int
-- ^ number of edges to generate
->
Int
-- ^ number of nodes in the graph
->
IO
[(
Int
,
Int
)]
randEdges
n
nd
=
do
fr
<-
replicateM
(
2
*
n
)
$
randomRIO
(
0
,
nd
-
1
)
to
<-
replicateM
(
2
*
n
)
$
randomRIO
(
0
,
nd
-
1
)
return
$
take
n
$
nub
$
filter
(
uncurry
(
/=
))
$
zip
fr
to
tests/test.hs
0 → 100644
View file @
b3220726
import
qualified
Test.Basic
as
Basic
import
Test.Tasty
main
::
IO
()
main
=
defaultMain
$
testGroup
"Haskell-igraph Tests"
[
Basic
.
tests
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment