diff --git a/lua/README.md b/lua/README.md index 9553088d..07b547ef 100644 --- a/lua/README.md +++ b/lua/README.md @@ -17,3 +17,4 @@ - [hello-world](./hello-world/README.md) - [reverse-string](./reverse-string/README.md) - [raindrops](./raindrops/README.md) +- [leap](./leap/README.md) diff --git a/lua/leap/.busted b/lua/leap/.busted new file mode 100644 index 00000000..86b84e7c --- /dev/null +++ b/lua/leap/.busted @@ -0,0 +1,5 @@ +return { + default = { + ROOT = { '.' } + } +} diff --git a/lua/leap/.exercism/config.json b/lua/leap/.exercism/config.json new file mode 100644 index 00000000..74b666d9 --- /dev/null +++ b/lua/leap/.exercism/config.json @@ -0,0 +1,24 @@ +{ + "authors": [ + "aarti" + ], + "contributors": [ + "etandel", + "kytrinyx", + "ryanplusplus" + ], + "files": { + "solution": [ + "leap.lua" + ], + "test": [ + "leap_spec.lua" + ], + "example": [ + ".meta/example.lua" + ] + }, + "blurb": "Given a year, report if it is a leap year.", + "source": "CodeRanch Cattle Drive, Assignment 3", + "source_url": "https://coderanch.com/t/718816/Leap" +} diff --git a/lua/leap/.exercism/metadata.json b/lua/leap/.exercism/metadata.json new file mode 100644 index 00000000..f0ffb2e8 --- /dev/null +++ b/lua/leap/.exercism/metadata.json @@ -0,0 +1 @@ +{"track":"lua","exercise":"leap","id":"77f06ba74c2b49e5b6c9cf8aa3a0dfee","url":"https://exercism.org/tracks/lua/exercises/leap","handle":"vpayno","is_requester":true,"auto_approve":false} \ No newline at end of file diff --git a/lua/leap/HELP.md b/lua/leap/HELP.md new file mode 100644 index 00000000..3c4b3021 --- /dev/null +++ b/lua/leap/HELP.md @@ -0,0 +1,54 @@ +# Help + +## Running the tests + +To run the tests, run the command `busted` from within the exercise directory. + +Refer to the [Installing Lua locally][install] documentation to get Lua and busted installed correctly. + +[install]: https://exercism.org/docs/tracks/lua/installation + +## Submitting your solution + +You can submit your solution using the `exercism submit leap.lua` command. +This command will upload your solution to the Exercism website and print the solution page's URL. + +It's possible to submit an incomplete solution which allows you to: + +- See how others have completed the exercise +- Request help from a mentor + +## Need to get help? + +If you'd like help solving the exercise, check the following pages: + +- The [Lua track's documentation](https://exercism.org/docs/tracks/lua) +- The [Lua track's programming category on the forum](https://forum.exercism.org/c/programming/lua) +- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5) +- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs) + +Should those resources not suffice, you could submit your (incomplete) solution to request mentoring. + +There are many great free online resources for Lua including: + +1. [lua.org][8] +2. A highly recommended detailed and authoritative introduction to all aspects of Lua programming by Lua's chief architect: [Programming in Lua, by Roberto Ierusalimschy][6]. Note that the first edition (covering Lua 5.0) is [freely available online][9]. +3. For an official definition of the Lua language, consult the [Lua 5.4 Reference Manual][7], by R. Ierusalimschy, L. H. de Figueiredo, W. Celes. +4. [Lua Style Guide][4] +5. [Learn Lua in 15 minutes][5] +6. Some options for linting + - [Lua Lint][10] + - [Lua Inspect][11] + - [luacheck][12] + - [Detecting Undefined Variables][13] + +[4]: https://github.com/Olivine-Labs/lua-style-guide +[5]: http://tylerneylon.com/a/learn-lua/ +[6]: http://www.lua.org/pil/ +[7]: http://www.lua.org/manual/5.4/ +[8]: http://www.lua.org +[9]: http://www.lua.org/pil/contents.html +[10]: http://lua-users.org/wiki/LuaLint +[11]: http://lua-users.org/wiki/LuaInspect +[12]: https://github.com/luarocks/luacheck +[13]: http://lua-users.org/wiki/DetectingUndefinedVariables \ No newline at end of file diff --git a/lua/leap/README.md b/lua/leap/README.md new file mode 100644 index 00000000..e80fd0d9 --- /dev/null +++ b/lua/leap/README.md @@ -0,0 +1,48 @@ +# Leap + +Welcome to Leap on Exercism's Lua Track. +If you need help running the tests or submitting your code, check out `HELP.md`. + +## Instructions + +Given a year, report if it is a leap year. + +The tricky thing here is that a leap year in the Gregorian calendar occurs: + +```text +on every year that is evenly divisible by 4 + except every year that is evenly divisible by 100 + unless the year is also evenly divisible by 400 +``` + +For example, 1997 is not a leap year, but 1996 is. +1900 is not a leap year, but 2000 is. + +## Notes + +Though our exercise adopts some very simple rules, there is more to learn! + +For a delightful, four minute explanation of the whole leap year phenomenon, go watch [this youtube video][video]. + +[video]: https://www.youtube.com/watch?v=xX96xng7sAE + +## Source + +### Created by + +- @aarti + +### Contributed to by + +- @etandel +- @kytrinyx +- @ryanplusplus + +### Based on + +CodeRanch Cattle Drive, Assignment 3 - https://coderanch.com/t/718816/Leap + +### My Solution + +- [my solution](./leap.lua) +- [run-tests](./run-tests-lua.txt) diff --git a/lua/leap/leap.lua b/lua/leap/leap.lua new file mode 100644 index 00000000..3f5fe1c4 --- /dev/null +++ b/lua/leap/leap.lua @@ -0,0 +1,17 @@ +local leap_year = function(year) + if year % 400 == 0 then + return true + end + + if year % 100 == 0 then + return false + end + + if year % 4 == 0 then + return true + end + + return false +end + +return leap_year diff --git a/lua/leap/leap_spec.lua b/lua/leap/leap_spec.lua new file mode 100644 index 00000000..89e11854 --- /dev/null +++ b/lua/leap/leap_spec.lua @@ -0,0 +1,19 @@ +local is_leap_year = require("leap") + +describe("leap", function() + it("a known leap year", function() + assert.is_true(is_leap_year(1996)) + end) + + it("any old year", function() + assert.is_false(is_leap_year(1997)) + end) + + it("turn of the 20th century", function() + assert.is_false(is_leap_year(1900)) + end) + + it("turn of the 21st century", function() + assert.is_true(is_leap_year(2000)) + end) +end) diff --git a/lua/leap/luacov.report.out b/lua/leap/luacov.report.out new file mode 100644 index 00000000..9a8d2591 --- /dev/null +++ b/lua/leap/luacov.report.out @@ -0,0 +1,55 @@ +============================================================================== +leap_spec.lua +============================================================================== +* local is_leap_year = require('leap') + +* describe('leap', function() +* it('a known leap year', function() +* assert.is_true(is_leap_year(1996)) + end) + +* it('any old year', function() +* assert.is_false(is_leap_year(1997)) + end) + +* it('turn of the 20th century', function() +* assert.is_false(is_leap_year(1900)) + end) + +* it('turn of the 21st century', function() +* assert.is_true(is_leap_year(2000)) + end) + end) + +============================================================================== +leap.lua +============================================================================== + local leap_year = function(year) + +* if year % 400 == 0 then +* return true + end + +* if year % 100 == 0 then +* return false + end + +* if year % 4 == 0 then +* return true + end + +* return false + end + +* return leap_year + +============================================================================== +Summary +============================================================================== + +File Hits Missed Coverage +---------------------------------- +leap.lua 8 0 100.00% +leap_spec.lua 10 0 100.00% +---------------------------------- +Total 18 0 100.00% diff --git a/lua/leap/luacov.report.out.index b/lua/leap/luacov.report.out.index new file mode 100644 index 00000000..5bc94858 --- /dev/null +++ b/lua/leap/luacov.report.out.index @@ -0,0 +1,3 @@ +leap_spec.lua:0 620 +leap.lua:620 1057 +Summary:1057 1431 diff --git a/lua/leap/luacov.stats.out b/lua/leap/luacov.stats.out new file mode 100644 index 00000000..ff73fc61 --- /dev/null +++ b/lua/leap/luacov.stats.out @@ -0,0 +1,60 @@ +163:/usr/share/lua/5.1/busted/block.lua +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 68 0 68 69 0 1 4 4 72 68 64 0 0 5 0 0 0 0 0 0 1 0 1 12 0 12 8 8 0 0 0 0 12 3 0 12 12 9 0 0 3 3 0 0 0 0 0 0 3 0 3 1 0 1 15 0 15 8 8 0 0 0 0 15 0 15 15 0 0 0 0 0 15 1 0 1 18 18 0 18 18 0 0 0 0 0 0 18 8 0 0 0 18 1 0 1 4 1 0 1 3 3 3 0 4 0 1 3 1 0 1 3 1 0 1 2 0 2 2 2 0 0 0 0 2 0 2 2 0 2 0 0 0 0 2 2 0 0 2 2 0 3 0 1 +124:/usr/share/lua/5.1/busted/context.lua +0 0 0 1 42 41 0 1 1 1 1 1 0 0 0 1 42 41 0 89 88 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 6 1 5 0 5 0 0 6 6 0 0 6 6 0 0 6 1 0 6 0 0 93 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 6 6 6 0 0 4 0 0 0 304 0 0 0 26 26 26 26 26 0 0 26 26 26 26 26 +315:/usr/share/lua/5.1/busted/core.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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 +50:/usr/share/lua/5.1/busted/languages/en.lua +1 0 1 0 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 +23:/usr/share/lua/5.1/busted/modules/files/lua.lua +1 0 1 0 0 5 5 5 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 +107:/usr/share/lua/5.1/busted/modules/files/moonscript.lua +1 0 2 1 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 1 +129:/usr/share/lua/5.1/busted/modules/filter_loader.lua +0 0 0 4 4 0 8 8 4 4 0 0 4 1 0 0 0 0 1 0 0 5 0 0 0 0 5 1 0 0 4 4 0 0 0 0 4 1 0 0 5 0 0 0 0 5 1 0 0 4 0 0 0 0 4 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 8 14 10 0 0 9 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 1 +34:/usr/share/lua/5.1/busted/modules/output_handler_loader.lua +0 0 0 0 0 0 0 0 1 2 1 0 1 0 0 1 0 2 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 1 +101:/usr/share/lua/5.1/busted/modules/test_file_loader.lua +1 0 0 1 1 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 79 0 0 79 0 0 79 0 0 0 0 0 0 75 75 +29:/usr/share/lua/5.1/say/init.lua +0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 19 19 +18:leap.lua +0 0 4 1 0 0 3 1 0 0 2 1 0 0 1 1 0 1 +19:leap_spec.lua +1 0 2 2 1 2 0 2 1 2 0 2 1 2 0 2 1 2 3 diff --git a/lua/leap/run-tests-lua.txt b/lua/leap/run-tests-lua.txt new file mode 100644 index 00000000..d53864e4 --- /dev/null +++ b/lua/leap/run-tests-lua.txt @@ -0,0 +1,91 @@ +Running automated test file(s): + + +=============================================================================== + +Running: luacheck --no-color ./leap.lua +Checking leap.lua OK + +Total: 0 warnings / 0 errors in 1 file + +real 0m0.035s +user 0m0.020s +sys 0m0.015s + +=============================================================================== + +Running: busted --coverage --lpath= --cpath= --output=gtest -Xoutput --plain +[==========] Running tests from scanned files. +[----------] Global test environment setup. +[----------] Running tests from ./leap_spec.lua +[ RUN ] ./leap_spec.lua @ 4: leap a known leap year +[ OK ] ./leap_spec.lua @ 4: leap a known leap year (0.45 ms) +[ RUN ] ./leap_spec.lua @ 8: leap any old year +[ OK ] ./leap_spec.lua @ 8: leap any old year (0.52 ms) +[ RUN ] ./leap_spec.lua @ 12: leap turn of the 20th century +[ OK ] ./leap_spec.lua @ 12: leap turn of the 20th century (0.57 ms) +[ RUN ] ./leap_spec.lua @ 16: leap turn of the 21st century +[ OK ] ./leap_spec.lua @ 16: leap turn of the 21st century (0.45 ms) +[----------] 4 tests from ./leap_spec.lua (11.89 ms total) + +[----------] Global test environment teardown. +[==========] 4 tests from 1 test file ran. (13.66 ms total) +[ PASSED ] 4 tests. + +real 0m0.039s +user 0m0.033s +sys 0m0.005s + +=============================================================================== + +Running: luacov . + +real 0m0.063s +user 0m0.060s +sys 0m0.003s + +=============================================================================== + +Running: luacov-console . + +real 0m0.014s +user 0m0.011s +sys 0m0.003s + +Running: luacov-console --no-colored --summary . +============================================================================== +Summary +============================================================================== + +File Hits Missed Coverage +---------------------------------- +leap.lua 8 0 100.00% +leap_spec.lua 10 0 100.00% +---------------------------------- +Total 18 0 100.00% + +real 0m0.017s +user 0m0.011s +sys 0m0.005s + +=============================================================================== + +Running: stylua ./leap.lua ./leap_spec.lua + +real 0m0.011s +user 0m0.007s +sys 0m0.006s + +=============================================================================== + +Running: misspell . + +real 0m0.034s +user 0m0.035s +sys 0m0.016s + +=============================================================================== + + +=============================================================================== +