results are sorted in the natural manner when multiple outputs are evaluated

This commit is contained in:
Filip Graliński 2018-06-28 16:32:46 +02:00
parent 338ddb7fbf
commit 1278081a48
3 changed files with 6 additions and 2 deletions

View File

@ -61,6 +61,7 @@ library
, bzlib-conduit
, lzma-conduit
, Glob
, naturalcomp
default-language: Haskell2010
executable geval

View File

@ -58,6 +58,8 @@ import System.FilePath
import Data.Maybe
import Data.Tuple
import qualified Data.List.Split as DLS
import Data.List (sortBy)
import Text.NaturalComp
import Control.Monad.IO.Class
import Control.Monad ((<=<), filterM)
@ -276,7 +278,8 @@ data LineSource m = LineSource (Source m Text) SourceSpec Word32
geval :: GEvalSpecification -> IO [(SourceSpec, [MetricValue])]
geval gevalSpec = do
(inputSource, expectedSource, outSources) <- checkAndGetFiles False gevalSpec
Prelude.mapM (gevalOnSingleOut gevalSpec inputSource expectedSource) outSources
results <- Prelude.mapM (gevalOnSingleOut gevalSpec inputSource expectedSource) outSources
return $ sortBy (\a b -> (show $ fst a) `naturalComp` (show $ fst b)) results
gevalOnSingleOut :: GEvalSpecification -> SourceSpec -> SourceSpec -> SourceSpec -> IO (SourceSpec, [MetricValue])
gevalOnSingleOut gevalSpec inputSource expectedSource outSource = do

View File

@ -1,5 +1,5 @@
flags: {}
packages:
- '.'
extra-deps: [murmur3-1.0.3]
extra-deps: [murmur3-1.0.3,naturalcomp-0.0.3]
resolver: lts-11.9