Add elm folder

This commit is contained in:
Naomi Dennis 2020-01-22 10:57:36 -05:00
parent 1cd3ba5e2c
commit 070169c89a
59 changed files with 6660 additions and 0 deletions

21
elm/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Naomi Dennis
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.

3
elm/README.md Normal file
View File

@ -0,0 +1,3 @@
# gilded_rose_elm
To run tests, enter `elm-test`

Binary file not shown.

Binary file not shown.

BIN
elm/elm-stuff/0.19.1/d.dat Normal file

Binary file not shown.

BIN
elm/elm-stuff/0.19.1/i.dat Normal file

Binary file not shown.

View File

BIN
elm/elm-stuff/0.19.1/o.dat Normal file

Binary file not shown.

View File

@ -0,0 +1,29 @@
{
"type": "application",
"source-directories": [
"src",
"../../../../../../../../../../../usr/local/lib/node_modules/elm-test/elm/src",
"../../../../../src",
"../../../../../tests"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/core": "1.0.4",
"elm/json": "1.1.3",
"elm/random": "1.0.0",
"elm/time": "1.0.0",
"elm/browser": "1.0.2",
"elm/html": "1.0.0",
"elm-explorations/test": "1.2.2"
},
"indirect": {
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.2"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}

View File

@ -0,0 +1,14 @@
module Test.Generated.Main1505781568 exposing (main)
import GildedRoseTest
import Test.Reporter.Reporter exposing (Report(..))
import Console.Text exposing (UseColor(..))
import Test.Runner.Node
import Test
main : Test.Runner.Node.TestProgram
main =
[ Test.describe "GildedRoseTest" [GildedRoseTest.suite] ]
|> Test.concat
|> Test.Runner.Node.run { runs = Nothing, report = (ConsoleReport UseColor), seed = 333140979127867, processes = 8, paths = ["/Users/naomidennis/Documents/code-projects/elm/gilded_rose_elm/tests/GildedRoseTest.elm"]}

View File

@ -0,0 +1,14 @@
module Test.Generated.Main2769340559 exposing (main)
import GildedRoseTest
import Test.Reporter.Reporter exposing (Report(..))
import Console.Text exposing (UseColor(..))
import Test.Runner.Node
import Test
main : Test.Runner.Node.TestProgram
main =
[ Test.describe "GildedRoseTest" [GildedRoseTest.suite] ]
|> Test.concat
|> Test.Runner.Node.run { runs = Nothing, report = (ConsoleReport UseColor), seed = 51319785517590, processes = 8, paths = ["/Users/naomidennis/Documents/code-projects/elm/gilded_rose_elm/tests/GildedRoseTest.elm"]}

View File

@ -0,0 +1,14 @@
module Test.Generated.Main3492374619 exposing (main)
import GildedRoseTest
import Test.Reporter.Reporter exposing (Report(..))
import Console.Text exposing (UseColor(..))
import Test.Runner.Node
import Test
main : Test.Runner.Node.TestProgram
main =
[ Test.describe "GildedRoseTest" [GildedRoseTest.suite] ]
|> Test.concat
|> Test.Runner.Node.run { runs = Nothing, report = (ConsoleReport UseColor), seed = 387860746875023, processes = 8, paths = ["/Users/naomidennis/Documents/code-projects/elm/gilded_rose_elm/tests/GildedRoseTest.elm"]}

28
elm/elm.json Normal file
View File

@ -0,0 +1,28 @@
{
"type": "application",
"source-directories": [
"src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.2",
"elm/core": "1.0.4",
"elm/html": "1.0.0"
},
"indirect": {
"elm/json": "1.1.3",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.2"
}
},
"test-dependencies": {
"direct": {
"elm-explorations/test": "1.2.2"
},
"indirect": {
"elm/random": "1.0.0"
}
}
}

53
elm/src/GildedRose.elm Normal file
View File

@ -0,0 +1,53 @@
module GildedRose exposing (Item, update_quality)
type alias Item =
{ name : String
, sell_by : Int
, quality : Int
}
update_quality : List Item -> List Item
update_quality items =
List.map
(\item ->
if item.name == "Aged Brie" || item.name == "Backstage passes to a TAFKAL80ETC concert" then
if item.quality < 50 then
if item.name == "Backstage passes to a TAFKAL80ETC concert" then
if item.sell_by < 0 then
{ item | sell_by = item.sell_by - 1, quality = 0 }
else if item.sell_by < 6 then
{ item | sell_by = item.sell_by - 1, quality = item.quality + 3 }
else if item.sell_by < 11 then
{ item | sell_by = item.sell_by - 1, quality = item.quality + 2 }
else
{ item | sell_by = item.sell_by - 1, quality = item.quality + 1 }
else
{ item | sell_by = item.sell_by - 1, quality = item.quality + 1 }
else
{ item | sell_by = item.sell_by }
else if item.name /= "Aged Brie" && item.name /= "Sulfuras, Hand of Ragnaros" then
if item.sell_by < 0 && item.quality > 0 then
if item.quality >= 2 then
{ item | sell_by = item.sell_by - 1, quality = item.quality - 2 }
else
{ item | sell_by = item.sell_by - 1, quality = 0 }
else if item.quality >= 1 then
{ item | sell_by = item.sell_by - 1, quality = item.quality - 1 }
else
{ item | sell_by = item.sell_by - 1, quality = 0 }
else
item
)
items

7
elm/src/Main.elm Normal file
View File

@ -0,0 +1,7 @@
module Main exposing (main)
import Html exposing (..)
main =
text "Gilded Rose"

View File

@ -0,0 +1,18 @@
module GildedRoseTest exposing (..)
import Expect exposing (Expectation)
import Fuzz exposing (Fuzzer, int, list, string)
import GildedRose exposing (..)
import Test exposing (..)
suite : Test
suite =
test "example test"
(\_ ->
let
foo =
Item "foo" 10 30
in
Expect.equal foo.name "fixme"
)