-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
4c2cf07
commit 98165f3
Showing
13 changed files
with
117 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>HelVM.HelCT.HelCT</title><link href="linuwial.css" rel="stylesheet" type="text/css" title="Linuwial" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><span class="caption">helct-0.1.0.0: HELCT - Heavenly Esoteric Little C Transpiler to Esoteric Languages</span><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">HelVM.HelCT.HelCT</p></div><div id="interface"></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.24.2</p></div></body></html> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>HelVM.HelCT.HelCT</title><link href="linuwial.css" rel="stylesheet" type="text/css" title="Linuwial" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><span class="caption">helct-0.1.0.0: HELCT - Heavenly Esoteric Little C Transpiler to Esoteric Languages</span><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">HelVM.HelCT.HelCT</p></div><div id="interface"></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.28.0</p></div></body></html> |
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 |
---|---|---|
@@ -1 +1 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>helct-0.1.0.0: HELCT - Heavenly Esoteric Little C Transpiler to Esoteric Languages (Index)</title><link href="linuwial.css" rel="stylesheet" type="text/css" title="Linuwial" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><span class="caption">helct-0.1.0.0: HELCT - Heavenly Esoteric Little C Transpiler to Esoteric Languages</span><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul></div><div id="content"></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.24.2</p></div></body></html> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>helct-0.1.0.0: HELCT - Heavenly Esoteric Little C Transpiler to Esoteric Languages (Index)</title><link href="linuwial.css" rel="stylesheet" type="text/css" title="Linuwial" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><span class="caption">helct-0.1.0.0: HELCT - Heavenly Esoteric Little C Transpiler to Esoteric Languages</span><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul></div><div id="content"></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.28.0</p></div></body></html> |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
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 |
---|---|---|
@@ -1 +1 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>helct-0.1.0.0: HELCT - Heavenly Esoteric Little C Transpiler to Esoteric Languages</title><link href="linuwial.css" rel="stylesheet" type="text/css" title="Linuwial" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><span class="caption">helct-0.1.0.0: HELCT - Heavenly Esoteric Little C Transpiler to Esoteric Languages</span><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul></div><div id="content"><div id="description"><h1>helct-0.1.0.0: HELCT - Heavenly Esoteric Little C Transpiler to Esoteric Languages</h1><div class="doc"><p>Please see the README on GitHub at <a href="https://github.com/helvm/helct#readme">https://github.com/helvm/helct#readme</a></p></div></div><div id="module-list"><p class="caption">Modules</p><ul><li><span class="module details-toggle-control details-toggle" data-details-id="n.1">HelVM</span><details id="n.1" open="open"><summary class="hide-when-js-enabled">Submodules</summary><ul><li><span class="module details-toggle-control details-toggle" data-details-id="n.1.1">HelCT</span><details id="n.1.1" open="open"><summary class="hide-when-js-enabled">Submodules</summary><ul><li><span class="module"><span class="noexpander"> </span><a href="HelVM-HelCT-HelCT.html">HelVM.HelCT.HelCT</a></span></li></ul></details></li></ul></details></li></ul></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.24.2</p></div></body></html> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>helct-0.1.0.0: HELCT - Heavenly Esoteric Little C Transpiler to Esoteric Languages</title><link href="linuwial.css" rel="stylesheet" type="text/css" title="Linuwial" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><span class="caption">helct-0.1.0.0: HELCT - Heavenly Esoteric Little C Transpiler to Esoteric Languages</span><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul></div><div id="content"><div id="description"><h1>helct-0.1.0.0: HELCT - Heavenly Esoteric Little C Transpiler to Esoteric Languages</h1><div class="doc"><p>Please see the README on GitHub at <a href="https://github.com/helvm/helct#readme">https://github.com/helvm/helct#readme</a></p></div></div><div id="module-list"><p class="caption">Modules</p><div id="module-list"><p class="caption">helct-0.1.0.0</p><ul><li><span class="module details-toggle-control details-toggle" data-details-id="n.1">HelVM</span><details id="n.1" open="open"><summary class="hide-when-js-enabled">Submodules</summary><ul><li><span class="module details-toggle-control details-toggle" data-details-id="n.1.1">HelCT</span><details id="n.1.1" open="open"><summary class="hide-when-js-enabled">Submodules</summary><ul><li><span class="module"><span class="noexpander"> </span><a href="HelVM-HelCT-HelCT.html">HelVM.HelCT.HelCT</a></span></li></ul></details></li></ul></details></li></ul></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.28.0</p></div></body></html> |
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 |
---|---|---|
@@ -1 +1 @@ | ||
{"haddock_version":"2.24.2"} | ||
{"haddock_version":"2.28.0"} |
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 |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
left: calc(50% - 22em); | ||
width: 44em; | ||
z-index: 1000; | ||
pointer-events: none; | ||
overflow-y: auto; | ||
} | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,10 +1,8 @@ | ||
module Main where | ||
|
||
import Slow | ||
import qualified Spec | ||
import Test.Hspec (hspec) | ||
import Test.Hspec.Slow | ||
import Test.Hspec (hspec) | ||
|
||
main :: IO () | ||
main = do | ||
config <- configure 1 | ||
hspec $ timeThese config Spec.spec | ||
main = (hspec . flip timeThese Spec.spec) =<< configure 1 |
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,82 @@ | ||
{-# LANGUAGE BangPatterns #-} | ||
{-# LANGUAGE RankNTypes #-} | ||
|
||
module Slow ( | ||
configure, | ||
timedHspec, | ||
timedHspecParallel, | ||
timeThese | ||
) where | ||
|
||
import Control.Concurrent.STM.TVar hiding (newTVarIO, readTVarIO) | ||
import Data.Time.Clock | ||
import Test.Hspec | ||
import Test.Hspec.Core.Spec | ||
|
||
type SlowResults = [(String, NominalDiffTime)] | ||
type SlowResultTracker = TVar SlowResults | ||
|
||
data SlowConfiguration = SlowConfiguration { | ||
duration :: !Int, | ||
tracker :: !SlowResultTracker | ||
} | ||
|
||
configure :: Int -> IO SlowConfiguration | ||
configure x = | ||
newTVarIO [] >>= \t -> | ||
return (SlowConfiguration x t) | ||
|
||
stopwatch :: MonadIO m => m a -> m (a, NominalDiffTime) | ||
stopwatch x = do | ||
start <- liftIO getCurrentTime | ||
!a <- x | ||
end <- liftIO getCurrentTime | ||
return (a, end `diffUTCTime` start) | ||
|
||
trackedAction :: MonadIO m => String -> m a -> ReaderT SlowConfiguration m a | ||
trackedAction s m = do | ||
conf <- ask | ||
(result, d) <- lift (stopwatch m) | ||
if d > (realToFrac . duration $ conf) | ||
then do | ||
liftIO $ atomically $ modifyTVar (tracker conf) (++ [(s, d)]) | ||
return result | ||
else return result | ||
|
||
type Timer = forall m a. (MonadIO m, Example (m a)) => String -> m a -> SpecWith (Arg (m a)) | ||
|
||
timed :: SlowConfiguration -> Timer | ||
timed c s a = it s $ runReaderT (trackedAction s a) c | ||
|
||
slowReport :: (MonadIO m) => SlowConfiguration -> m () | ||
slowReport s = do | ||
liftIO $ do | ||
slows <- readTVarIO (tracker s) | ||
putStrLn "Slow examples:" | ||
mapM_ (\(t, v) -> putStrLn $ show v ++ ": " ++ t) slows | ||
|
||
timedHspec :: SlowConfiguration -> (Timer -> SpecWith ()) -> IO () | ||
timedHspec t x = hspec $ (afterAll_ . slowReport) t $ x (timed t) | ||
|
||
timedHspecParallel :: SlowConfiguration -> (Timer -> SpecWith ()) -> IO () | ||
timedHspecParallel t x = hspec $ (afterAll_ . slowReport) t $ parallel $ x (timed t) | ||
|
||
-- | times all tests without having to use a custom `it` function | ||
timeThese :: SlowConfiguration -> SpecWith a -> SpecWith a | ||
timeThese config = afterAll_ (slowReport config) . mapSpecItem_ (modifyAroundAction $ adhocMeasure config) | ||
|
||
adhocMeasure :: SlowConfiguration -> Item a -> (a -> IO ()) -> a -> IO () | ||
adhocMeasure config item theTestF a = runReaderT (trackedAction (makeDescription item) $ theTestF a) config | ||
|
||
makeDescription :: Item a -> String | ||
makeDescription item = defaultDescription (itemLocation item) <> "\n\t" <> | ||
itemRequirement item | ||
|
||
defaultDescription :: Maybe Location -> String | ||
defaultDescription stack = fromMaybe ("source location not found: " <> show stack) $ do | ||
Location locationFile locationLine locationColumn <- stack | ||
pure (locationFile ++ "[" ++ show locationLine ++ ":" ++ show locationColumn ++ "]") | ||
|
||
modifyAroundAction :: (Item a -> ActionWith a -> ActionWith b) -> Item a -> Item b | ||
modifyAroundAction action item@Item{itemExample = e} = | ||
item{ itemExample = \params aroundAction -> e params (aroundAction . action item) } |