packages feed

phladiprelio-tests (empty) → 0.1.0.0

raw patch · 4 files changed

+195/−0 lines, 4 filesdep +base

Dependencies added: base

Files

+ CHANGELOG.md view
@@ -0,0 +1,6 @@+# Revision history for phladiprelio-tests++## 0.1.0.0 -- 2023-08-14++* First version. Released on an unsuspecting world.+
+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2023 Oleksandr Zhabenko++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ Phladiprelio/Tests.hs view
@@ -0,0 +1,95 @@+{-# LANGUAGE NoImplicitPrelude #-}++module Phladiprelio.Tests where++import GHC.Base+import GHC.Int (Int8)+import GHC.Enum (toEnum)+import GHC.Real (quot,rem)+import GHC.Num ((+),(-),(*))+import GHC.List (elem)++sel :: Int -> [[Int8]]+sel x +   | x == 1 || x < 0 || x > 179 = []+   | x == 0 || x == 4 = [[1],[2,1],[3,2],[4,3,2],[5,4,3],[6,5,4,3,2]]  -- all cases are present: 2, 3, 4, 5, 6, 7. Therefore, the slowest ones.+   | x == 2 || x == 5 = [[1],[2],[3],[4,3],[5,4],[6,5,4]]+   | x == 7 = [[0],[1,0],[1,0],[1,0],[1,0],[1,0]]+   | x == 8 = [[0],[1,0],[1,0],[2,1,0],[2,1,0],[2,1,0]]+   | x == 9 = [[0],[1,0],[1,0],[2,1,0],[3,2,1,0],[3,2,1,0]]+------------------------------------------------------------------+   | x >= 20 && x <= 26 && x /= 21 = [[1]]  -- at least 7 is omitted, but probably 6, or even 5, or even 4, or even 3. 2 is however present.+   | x >= 27 && x <= 29 = [[0]]+   | x == 30 || x == 34 = [[1],[2,1]]+   | x == 32 || x == 35 = [[1],[2]]+   | x >= 37 && x <= 39 = [[0],[1,0]]+   | x == 40 || x == 44 = [[1],[2,1],[3,2]]+   | x == 42 || x == 45 = [[1],[2],[3]]+   | x >= 47 && x <= 49 = [[0],[1,0],[1,0]]+   | x == 50 || x == 54 = [[1],[2,1],[3,2],[4,3,2]]+   | x == 52 || x == 55 = [[1],[2],[3],[4,3]]+   | x == 57 = [[0],[1,0],[1,0],[1,0]]+   | x == 58 || x == 59 = [[0],[1,0],[1,0],[2,1,0]]+   | x == 60 || x == 64 = [[1],[2,1],[3,2],[4,3,2],[5,4,3]]+   | x == 62 || x == 65 = [[1],[2],[3],[4,3],[5,4]]+   | x == 67 = [[0],[1,0],[1,0],[1,0],[1,0]]+   | x == 68 = [[0],[1,0],[1,0],[2,1,0],[2,1,0]]+   | x == 69 = [[0],[1,0],[1,0],[2,1,0],[3,2,1,0]]+------------------------------------------------------+   | x == 70 || x == 74 = [[2,1],[3,2],[4,3,2],[5,4,3],[6,5,4,3,2]]  -- at least 2 is omitted, but probably 3 and even 4. 5, 6 and 7 are present.+   | x == 72 || x == 75 = [[2],[3],[4,3],[5,4],[6,5,4]]+   | x == 77 = [[1,0],[1,0],[1,0],[1,0],[1,0]]+   | x == 78 = [[1,0],[1,0],[2,1,0],[2,1,0],[2,1,0]]+   | x == 79 = [[1,0],[1,0],[2,1,0],[3,2,1,0],[3,2,1,0]]+   | x == 80 || x == 84 = [[3,2],[4,3,2],[5,4,3],[6,5,4,3,2]]+   | x == 82 || x == 85 = [[3],[4,3],[5,4],[6,5,4]]+   | x == 87 = [[1,0],[1,0],[1,0],[1,0]]+   | x == 88 = [[1,0],[2,1,0],[2,1,0],[2,1,0]]+   | x == 89 = [[1,0],[2,1,0],[3,2,1,0],[3,2,1,0]]+   | x == 90 || x == 94 = [[4,3,2],[5,4,3],[6,5,4,3,2]]+   | x == 92 || x == 95 = [[4,3],[5,4],[6,5,4]]+   | x == 97 = [[1,0],[1,0],[1,0]]+   | x == 98 = [[2,1,0],[2,1,0],[2,1,0]]+   | x == 99 = [[2,1,0],[3,2,1,0],[3,2,1,0]]+------------------------------------------------------------------------+   | x == 100 || x == 104 = [[1],[2,1],[4,3,2],[6,5,4,3,2]]  -- 4 and 6 are omitted, just present the ones from: 2, 3, 5, 7.+   | x == 102 || x == 105 = [[1],[2],[4,3],[6,5,4]]+   | x == 107 = [[0],[1,0],[1,0],[1,0]]+   | x == 108 = [[0],[1,0],[2,1,0],[2,1,0]]+   | x == 109 = [[0],[1,0],[2,1,0],[3,2,1,0]]+------------------------------------------------------------------+   | x == 150 || x == 154 = [[1],[2,1],[4,3,2]]  -- 4, 6, 7 are omitted but 2, 3, 5 are present.+   | x == 152 || x == 155 = [[1],[2],[4,3]]+   | x == 157 = [[0],[1,0],[1,0]]+   | x == 158 || x == 159 = [[0],[1,0],[2,1,0]]+------------------------------------------------------+   | x == 170 || x == 174 = [[2,1],[4,3,2],[6,5,4,3,2]]  -- just 3, 5 and 7 are present+   | x == 172 || x == 175 = [[2],[4,3],[6,5,4]]+   | x == 177 = [[1,0],[1,0],[1,0]]+   | x == 178 = [[1,0],[2,1,0],[2,1,0]]+   | x == 179 = [[1,0],[2,1,0],[3,2,1,0]]+----------------------------------------------------------------------- +   | otherwise = [[1],[1],[2,1],[3,2,1],[3,2],[4,3,2]]+--------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------++sel2 :: Int -> [Int8]+sel2 y +   | y == 1 || y < 0 || y > 179 = []+   | (rem y 10 `elem` [1,3,6]) || y >= 0 && y <= 9 = [2..7]+   | y >= 20 && y <= 69 = [2..toEnum (y `quot` 10)]+   | y >= 70 && y <= 99 = [toEnum (y `quot` 10) - 4..7]+   | y >= 100 && y <= 109 = [2,3,5,7]+   | y >= 150 && y <= 159 = [2,3,5]+   | y >= 170 && y <= 179 = [3,5,7]+   | otherwise = [2..7]++minMax11ByCList :: Ord a => (a -> a -> Ordering) -> [a] -> (a, a) -- Is rewritten from the 'Data.MinMax.Preconditions.minMax11ByC' from @subG@ package.+minMax11ByCList g xs@(x:y:ys) = foldr f (if x > y then (y, x) else (x, y)) ys+    where f z (x,y)+             | g z x == LT = (z,y)+             | g z y == GT = (x,z)+             | otherwise = (x,y)+minMax11ByCList _ _ = undefined -- Is not intended to be used for lists with less than two elements.++
+ phladiprelio-tests.cabal view
@@ -0,0 +1,74 @@+cabal-version:      1.24+-- The cabal-version field refers to the version of the .cabal specification,+-- and can be different from the cabal-install (the tool) version and the+-- Cabal (the library) version you are using. As such, the Cabal (the library)+-- version used must be equal or greater than the version stated in this field.+-- Starting from the specification version 2.2, the cabal-version field must be+-- the first thing in the cabal file.++-- Initial package description 'phladiprelio-tests' generated by+-- 'cabal init'. For further documentation, see:+--   http://haskell.org/cabal/users-guide/+--+-- The name of the package.+name:               phladiprelio-tests++-- The package version.+-- See the Haskell package versioning policy (PVP) for standards+-- guiding when and how versions should be incremented.+-- https://pvp.haskell.org+-- PVP summary:     +-+------- breaking API changes+--                  | | +----- non-breaking API additions+--                  | | | +--- code changes with no API change+version:            0.1.0.0++-- A short (one-line) description of the package.+synopsis:           Common for Ukrainian and general data for test mode.++-- A longer description of the package.+-- description:++-- URL for the project homepage or repository.+homepage:           https://hackage.haskell.org/package/phladiprelio-tests++-- The license under which the package is released.+license:            MIT++-- The file containing the license text.+license-file:       LICENSE++-- The package author(s).+author:             Oleksandr Zhabenko++-- An email address to which users can send suggestions, bug reports, and patches.+maintainer:         oleksandr.zhabenko@yahoo.com++-- A copyright notice.+copyright:          Oleksandr Zhabenko, 2023+category:           Language+build-type:         Simple++-- Extra doc files to be distributed with the package, such as a CHANGELOG or a README.+extra-doc-files:    CHANGELOG.md++-- Extra source files to be distributed with the package, such as examples, or a tutorial module.+-- extra-source-files:++library+    -- Modules exported by the library.+    exposed-modules:  Phladiprelio.Tests++    -- Modules included in this library but not exported.+    -- other-modules:++    -- LANGUAGE extensions used by modules in this package.+    other-extensions: NoImplicitPrelude++    -- Other library packages from which modules are imported.+    build-depends:    base >=4.13 && <5++    -- Directories containing source files.+    hs-source-dirs:   .++    -- Base language which the package is written in.+    default-language: Haskell2010