Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
Przemyslaw Kaminski
haskell-gargantext
Commits
f59e75d3
Commit
f59e75d3
authored
Mar 11, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TESTS][FIX] No Implicit Prelude for Tests too.
parent
644a7a89
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
84 additions
and
39 deletions
+84
-39
package.yaml
package.yaml
+2
-0
Main.hs
src-test/Main.hs
+11
-0
Lang.hs
src-test/Ngrams/Lang.hs
+1
-0
En.hs
src-test/Ngrams/Lang/En.hs
+3
-2
Occurrences.hs
src-test/Ngrams/Lang/Occurrences.hs
+2
-7
Metrics.hs
src-test/Ngrams/Metrics.hs
+8
-5
Date.hs
src-test/Parsers/Date.hs
+0
-1
Types.hs
src-test/Parsers/Types.hs
+4
-4
Analysis.hs
src/Gargantext/Analysis.hs
+16
-2
TextMining.hs
src/Gargantext/Ngrams/TextMining.hs
+1
-1
Prelude.hs
src/Gargantext/Prelude.hs
+2
-1
RCT.hs
src/Gargantext/RCT.hs
+13
-1
Main.hs
src/Gargantext/Types/Main.hs
+9
-15
DateUtils.hs
src/Gargantext/Utils/DateUtils.hs
+12
-0
No files found.
package.yaml
View file @
f59e75d3
...
...
@@ -149,6 +149,8 @@ tests:
garg-test
:
main
:
Main.hs
source-dirs
:
src-test
default-extensions
:
-
NoImplicitPrelude
ghc-options
:
-
-threaded
-
-rtsopts
...
...
src-test/Main.hs
View file @
f59e75d3
{-|
Module : Main.hs
Description : Main for Gargantext Tests
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
import
Gargantext.Prelude
import
Gargantext.Types.Main
(
Language
(
..
))
--import qualified Ngrams.Lang.Fr as Fr
import
qualified
Ngrams.Lang
as
Lang
...
...
src-test/Ngrams/Lang.hs
View file @
f59e75d3
module
Ngrams.Lang
where
import
Gargantext.Prelude
(
IO
())
import
Gargantext.Types.Main
(
Language
(
..
))
import
qualified
Ngrams.Lang.Fr
as
Fr
...
...
src-test/Ngrams/Lang/En.hs
View file @
f59e75d3
...
...
@@ -4,14 +4,15 @@
module
Ngrams.Lang.En
where
import
Data.List
((
!!
))
import
Data.Text
(
Text
)
import
Test.Hspec
import
Gargantext.Prelude
import
Gargantext.Types.Main
(
Language
(
..
))
import
Gargantext.Ngrams.Parser
(
extractNgrams
,
selectNgrams
)
import
Data.Text
(
Text
(
..
))
import
Data.List
((
!!
))
ngramsExtractionTest
::
IO
()
ngramsExtractionTest
=
hspec
$
do
...
...
src-test/Ngrams/Lang/Occurrences.hs
View file @
f59e75d3
...
...
@@ -4,18 +4,13 @@
module
Ngrams.Lang.Occurrences
where
import
Test.Hspec
import
Control.Exception
(
evaluate
)
import
Data.Text
(
Text
)
import
Data.Either
(
Either
(
Right
))
import
Gargantext.Prelude
import
Gargantext.Types.Main
(
Language
(
..
))
import
Gargantext.Ngrams
import
Gargantext.Ngrams.Occurrences
(
parseOccurrences
)
import
Gargantext.Ngrams.Parser
(
extractNgrams
,
selectNgrams
)
parsersTest
::
IO
()
parsersTest
=
hspec
$
do
describe
"Parser for occurrences"
$
do
...
...
src-test/Ngrams/Metrics.hs
View file @
f59e75d3
...
...
@@ -4,12 +4,15 @@
module
Ngrams.Metrics
(
main
)
where
import
Gargantext.Ngrams.Metrics
import
Data.Ratio
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
qualified
Data.Text
as
T
import
Data.Ratio
import
Test.Hspec
import
Test.QuickCheck
import
qualified
Data.Text
as
T
import
Gargantext.Prelude
import
Gargantext.Ngrams.Metrics
#
if
!
MIN_VERSION_base
(
4
,
8
,
0
)
import
Control.Applicative
...
...
@@ -121,5 +124,5 @@ testPair :: (Eq a, Show a)
->
Text
-- ^ Second input
->
a
-- ^ Expected result
->
SpecWith
()
testPair
f
a
b
r
=
it
(
"‘"
++
T
.
unpack
a
++
"’ and ‘"
++
T
.
unpack
b
++
"’"
)
$
testPair
f
a
b
r
=
it
(
"‘"
<>
T
.
unpack
a
<>
"’ and ‘"
<>
T
.
unpack
b
<>
"’"
)
$
f
a
b
`
shouldBe
`
r
src-test/Parsers/Date.hs
View file @
f59e75d3
...
...
@@ -9,7 +9,6 @@ import Test.QuickCheck
import
Parsers.Types
import
Control.Applicative
((
<*>
))
import
Data.Tuple
(
uncurry
)
import
Data.Either
(
Either
(
..
))
import
Data.Time
(
ZonedTime
(
..
))
import
Data.Text
(
pack
,
Text
)
...
...
src-test/Parsers/Types.hs
View file @
f59e75d3
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE StandaloneDeriving #-}
module
Parsers.Types
where
import
Gargantext.Prelude
import
Prelude
(
floor
,
fromIntegral
)
import
Test.QuickCheck
import
Test.QuickCheck.Instances
()
...
...
@@ -18,7 +18,7 @@ import Data.Either (Either(..))
deriving
instance
Eq
ZonedTime
looseTimeOfDayPrecision
::
TimeOfDay
->
TimeOfDay
looseTimeOfDayPrecision
(
TimeOfDay
h
m
s
)
=
TimeOfDay
h
m
0
looseTimeOfDayPrecision
(
TimeOfDay
h
m
_
)
=
TimeOfDay
h
m
0
looseLocalTimePrecision
::
LocalTime
->
LocalTime
looseLocalTimePrecision
(
LocalTime
ld
ltd
)
=
LocalTime
ld
$
looseTimeOfDayPrecision
ltd
...
...
src/Gargantext/Analysis.hs
View file @
f59e75d3
module
Gargantext.Analysis
where
{-|
Module : Gargantext.Analysis
Description : Gargantext Analysis
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
import
Gargantext.Prelude
{-# LANGUAGE NoImplicitPrelude #-}
module
Gargantext.Analysis
where
import
Gargantext.Prelude
(
undefined
,
IO
(),
Int
())
-- import qualified Data.Text.Lazy as DTL
import
Data.Text
...
...
src/Gargantext/Ngrams/TextMining.hs
View file @
f59e75d3
...
...
@@ -46,7 +46,7 @@ average x = L.sum x / L.genericLength x
average'
::
[
Int
]
->
Double
average'
x
=
(
L
.
sum
y
)
/
(
L
.
genericLength
y
)
where
y
=
map
fromIntegral
x
y
=
L
.
map
fromIntegral
x
countYear
::
[
Integer
]
->
Map
Integer
Integer
...
...
src/Gargantext/Prelude.hs
View file @
f59e75d3
...
...
@@ -24,7 +24,8 @@ import Protolude ( Bool(True, False), Int, Double, Integer
,
sum
,
fromIntegral
,
length
,
fmap
,
takeWhile
,
sqrt
,
undefined
,
identity
,
abs
,
maximum
,
minimum
,
return
,
snd
,
truncate
,
(
+
),
(
*
),
(
/
),
(
-
),
(
.
),
(
>=
),
(
$
),
(
**
),
(
^
),
(
<
),
(
>
),
(
==
),
(
<>
)
,
(
+
),
(
*
),
(
/
),
(
-
),
(
.
),
(
>=
),
(
$
),
(
**
),
(
^
),
(
<
),
(
>
)
,
Eq
,
(
==
),
(
<>
)
,
(
&&
),
(
||
),
not
,
toS
)
...
...
src/Gargantext/RCT.hs
View file @
f59e75d3
{-|
Module : Gargantext.
Description :
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE NoImplicitPrelude #-}
module
Gargantext.RCT
where
import
Gargantext.Prelude
...
...
@@ -51,4 +64,3 @@ foo = undefined
-- forms = words
src/Gargantext/Types/Main.hs
View file @
f59e75d3
...
...
@@ -21,22 +21,21 @@ commentary with @some markup@.
module
Gargantext.Types.Main
where
------------------------------------------------------------------------
import
Prelude
import
Protolude
(
fromMaybe
)
import
Data.Maybe
(
fromMaybe
)
import
Data.Eq
(
Eq
())
import
Data.Monoid
((
<>
))
import
Data.Text
(
Text
)
import
Data.Text
(
Text
,
pack
)
import
Data.List
(
lookup
)
import
Gargantext.Types.Node
import
Gargantext.Prelude
------------------------------------------------------------------------
------------------------------------------------------------------------
-- | Language of a Text
-- For simplicity, we suppose text has an homogenous language
data
Language
=
EN
|
FR
-- | DE | IT | SP
data
Language
=
EN
|
FR
-- | DE | IT | SP
-- > EN == english
-- > FR == french
-- > DE == deutch (not implemented yet)
...
...
@@ -44,11 +43,9 @@ data Language = EN | FR -- | DE | IT | SP
-- > SP == spanish (not implemented yet)
-- > ... add your language and help us to implement it (:
-- All the Database is structred like a hierarchical Tree
data
Tree
a
=
NodeT
a
[
Tree
a
]
deriving
(
Show
,
Read
,
Eq
)
deriving
(
Show
,
Read
,
Eq
)
-- data Tree a = NodeT a [Tree a]
-- same as Data.Tree
...
...
@@ -161,19 +158,16 @@ nodeTypes = [ (NodeUser , 1)
]
--
nodeTypeId
::
NodeType
->
NodeTypeId
nodeTypeId
tn
=
fromMaybe
(
error
$
"Typename "
<>
show
tn
<>
" does not exist"
)
nodeTypeId
tn
=
fromMaybe
(
panic
$
pack
$
"Typename "
<>
show
tn
<>
" does not exist"
)
(
lookup
tn
nodeTypes
)
-- Temporary types to be removed
type
Ngrams
=
(
Text
,
Text
,
Text
)
type
Ngrams
=
(
Text
,
Text
,
Text
)
type
ErrorMessage
=
Text
-- Queries
type
ParentId
=
NodeId
type
Limit
=
Int
type
Offset
=
Int
type
Offset
=
Int
src/Gargantext/Utils/DateUtils.hs
View file @
f59e75d3
{-|
Module : Gargantext.
Description :
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE NoImplicitPrelude #-}
module
Gargantext.Utils.DateUtils
where
import
Gargantext.Prelude
...
...
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