diff --git a/dart/leap/.dart_tool/package_config.json b/dart/leap/.dart_tool/package_config.json new file mode 100644 index 0000000..12f2ed0 --- /dev/null +++ b/dart/leap/.dart_tool/package_config.json @@ -0,0 +1,310 @@ +{ + "configVersion": 2, + "packages": [ + { + "name": "_fe_analyzer_shared", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/_fe_analyzer_shared-109.0.0", + "packageUri": "lib/", + "languageVersion": "3.11" + }, + { + "name": "analyzer", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/analyzer-14.5.0", + "packageUri": "lib/", + "languageVersion": "3.11" + }, + { + "name": "args", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/args-2.7.0", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "async", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/async-2.13.1", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "boolean_selector", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/boolean_selector-2.1.2", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "cli_config", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/cli_config-0.2.0", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "cli_util", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/cli_util-0.6.0", + "packageUri": "lib/", + "languageVersion": "3.7" + }, + { + "name": "collection", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/collection-1.19.1", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "convert", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/convert-3.1.2", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "coverage", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/coverage-1.16.0", + "packageUri": "lib/", + "languageVersion": "3.9" + }, + { + "name": "crypto", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/crypto-3.0.7", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "ffi", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/ffi-2.2.0", + "packageUri": "lib/", + "languageVersion": "3.7" + }, + { + "name": "file", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/file-7.0.1", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "frontend_server_client", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/frontend_server_client-4.1.0", + "packageUri": "lib/", + "languageVersion": "3.10" + }, + { + "name": "glob", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/glob-2.2.0", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "http_multi_server", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/http_multi_server-3.2.3", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "http_parser", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/http_parser-4.1.2", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "io", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/io-1.1.0", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "logging", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/logging-1.3.0", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "matcher", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/matcher-0.12.20", + "packageUri": "lib/", + "languageVersion": "3.10" + }, + { + "name": "meta", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/meta-1.19.0", + "packageUri": "lib/", + "languageVersion": "3.5" + }, + { + "name": "mime", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/mime-2.1.0", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "node_preamble", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/node_preamble-2.0.2", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "package_config", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/package_config-3.0.0", + "packageUri": "lib/", + "languageVersion": "3.11" + }, + { + "name": "path", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/path-1.9.1", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "pool", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/pool-1.5.3", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "pub_semver", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/pub_semver-2.2.1", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "shelf", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/shelf-1.4.3", + "packageUri": "lib/", + "languageVersion": "3.9" + }, + { + "name": "shelf_packages_handler", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/shelf_packages_handler-3.0.2", + "packageUri": "lib/", + "languageVersion": "2.17" + }, + { + "name": "shelf_static", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/shelf_static-1.2.0", + "packageUri": "lib/", + "languageVersion": "3.9" + }, + { + "name": "shelf_web_socket", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/shelf_web_socket-3.0.0", + "packageUri": "lib/", + "languageVersion": "3.5" + }, + { + "name": "source_map_stack_trace", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/source_map_stack_trace-2.1.2", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "source_maps", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/source_maps-0.10.14", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "source_span", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/source_span-1.10.2", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "stack_trace", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/stack_trace-1.12.2", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "stream_channel", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/stream_channel-2.1.4", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "string_scanner", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/string_scanner-1.4.1", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "term_glyph", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/term_glyph-1.2.2", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "test", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/test-1.33.0", + "packageUri": "lib/", + "languageVersion": "3.11" + }, + { + "name": "test_api", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/test_api-0.7.15", + "packageUri": "lib/", + "languageVersion": "3.11" + }, + { + "name": "test_core", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/test_core-0.6.21", + "packageUri": "lib/", + "languageVersion": "3.11" + }, + { + "name": "typed_data", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/typed_data-1.4.0", + "packageUri": "lib/", + "languageVersion": "3.5" + }, + { + "name": "vm_service", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/vm_service-15.4.0", + "packageUri": "lib/", + "languageVersion": "3.5" + }, + { + "name": "watcher", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/watcher-1.2.1", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "web", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/web-1.1.1", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "web_socket", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/web_socket-1.0.1", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "web_socket_channel", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/web_socket_channel-3.0.3", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "webkit_inspection_protocol", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/webkit_inspection_protocol-1.2.1", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "yaml", + "rootUri": "file:///home/sanctus/.pub-cache/hosted/pub.dev/yaml-3.1.4", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "leap", + "rootUri": "../", + "packageUri": "lib/", + "languageVersion": "3.2" + } + ], + "generator": "pub", + "generatorVersion": "3.11.0", + "flutterRoot": "file:///home/sanctus/flutter", + "flutterVersion": "3.41.2", + "pubCache": "file:///home/sanctus/.pub-cache" +} diff --git a/dart/leap/.dart_tool/package_graph.json b/dart/leap/.dart_tool/package_graph.json new file mode 100644 index 0000000..ef1473f --- /dev/null +++ b/dart/leap/.dart_tool/package_graph.json @@ -0,0 +1,457 @@ +{ + "roots": [ + "leap" + ], + "packages": [ + { + "name": "leap", + "version": "0.0.0", + "dependencies": [], + "devDependencies": [ + "test" + ] + }, + { + "name": "test", + "version": "1.33.0", + "dependencies": [ + "analyzer", + "async", + "boolean_selector", + "collection", + "coverage", + "http_multi_server", + "io", + "matcher", + "node_preamble", + "package_config", + "path", + "pool", + "shelf", + "shelf_packages_handler", + "shelf_static", + "shelf_web_socket", + "source_span", + "stack_trace", + "stream_channel", + "test_api", + "test_core", + "typed_data", + "web_socket_channel", + "webkit_inspection_protocol", + "yaml" + ] + }, + { + "name": "test_core", + "version": "0.6.21", + "dependencies": [ + "analyzer", + "args", + "async", + "boolean_selector", + "collection", + "coverage", + "frontend_server_client", + "glob", + "io", + "meta", + "package_config", + "path", + "pool", + "source_map_stack_trace", + "source_maps", + "source_span", + "stack_trace", + "stream_channel", + "test_api", + "vm_service", + "yaml" + ] + }, + { + "name": "test_api", + "version": "0.7.15", + "dependencies": [ + "async", + "boolean_selector", + "collection", + "meta", + "source_span", + "stack_trace", + "stream_channel", + "string_scanner", + "term_glyph" + ] + }, + { + "name": "shelf_packages_handler", + "version": "3.0.2", + "dependencies": [ + "path", + "shelf", + "shelf_static" + ] + }, + { + "name": "node_preamble", + "version": "2.0.2", + "dependencies": [] + }, + { + "name": "coverage", + "version": "1.16.0", + "dependencies": [ + "args", + "cli_config", + "cli_util", + "glob", + "logging", + "meta", + "package_config", + "path", + "source_maps", + "stack_trace", + "vm_service", + "yaml" + ] + }, + { + "name": "cli_util", + "version": "0.6.0", + "dependencies": [ + "ffi", + "meta", + "path" + ] + }, + { + "name": "cli_config", + "version": "0.2.0", + "dependencies": [ + "args", + "yaml" + ] + }, + { + "name": "ffi", + "version": "2.2.0", + "dependencies": [] + }, + { + "name": "yaml", + "version": "3.1.4", + "dependencies": [ + "collection", + "source_span", + "string_scanner" + ] + }, + { + "name": "boolean_selector", + "version": "2.1.2", + "dependencies": [ + "source_span", + "string_scanner" + ] + }, + { + "name": "source_map_stack_trace", + "version": "2.1.2", + "dependencies": [ + "path", + "source_maps", + "stack_trace" + ] + }, + { + "name": "glob", + "version": "2.2.0", + "dependencies": [ + "async", + "collection", + "file", + "path", + "string_scanner" + ] + }, + { + "name": "args", + "version": "2.7.0", + "dependencies": [] + }, + { + "name": "term_glyph", + "version": "1.2.2", + "dependencies": [] + }, + { + "name": "typed_data", + "version": "1.4.0", + "dependencies": [ + "collection" + ] + }, + { + "name": "pool", + "version": "1.5.3", + "dependencies": [ + "async", + "stack_trace" + ] + }, + { + "name": "frontend_server_client", + "version": "4.1.0", + "dependencies": [ + "async", + "package_config", + "path" + ] + }, + { + "name": "package_config", + "version": "3.0.0", + "dependencies": [ + "meta" + ] + }, + { + "name": "string_scanner", + "version": "1.4.1", + "dependencies": [ + "source_span" + ] + }, + { + "name": "file", + "version": "7.0.1", + "dependencies": [ + "meta", + "path" + ] + }, + { + "name": "path", + "version": "1.9.1", + "dependencies": [] + }, + { + "name": "webkit_inspection_protocol", + "version": "1.2.1", + "dependencies": [ + "logging" + ] + }, + { + "name": "stream_channel", + "version": "2.1.4", + "dependencies": [ + "async" + ] + }, + { + "name": "source_maps", + "version": "0.10.14", + "dependencies": [ + "source_span" + ] + }, + { + "name": "stack_trace", + "version": "1.12.2", + "dependencies": [ + "path" + ] + }, + { + "name": "shelf_static", + "version": "1.2.0", + "dependencies": [ + "convert", + "http_parser", + "mime", + "path", + "shelf" + ] + }, + { + "name": "matcher", + "version": "0.12.20", + "dependencies": [ + "async", + "meta", + "stack_trace", + "term_glyph", + "test_api" + ] + }, + { + "name": "async", + "version": "2.13.1", + "dependencies": [ + "collection", + "meta" + ] + }, + { + "name": "io", + "version": "1.1.0", + "dependencies": [ + "meta", + "path", + "string_scanner" + ] + }, + { + "name": "http_multi_server", + "version": "3.2.3", + "dependencies": [ + "async" + ] + }, + { + "name": "http_parser", + "version": "4.1.2", + "dependencies": [ + "collection", + "source_span", + "string_scanner", + "typed_data" + ] + }, + { + "name": "collection", + "version": "1.19.1", + "dependencies": [] + }, + { + "name": "convert", + "version": "3.1.2", + "dependencies": [ + "typed_data" + ] + }, + { + "name": "meta", + "version": "1.19.0", + "dependencies": [] + }, + { + "name": "logging", + "version": "1.3.0", + "dependencies": [] + }, + { + "name": "source_span", + "version": "1.10.2", + "dependencies": [ + "collection", + "path", + "term_glyph" + ] + }, + { + "name": "shelf_web_socket", + "version": "3.0.0", + "dependencies": [ + "shelf", + "stream_channel", + "web_socket_channel" + ] + }, + { + "name": "mime", + "version": "2.1.0", + "dependencies": [] + }, + { + "name": "analyzer", + "version": "14.5.0", + "dependencies": [ + "_fe_analyzer_shared", + "collection", + "convert", + "crypto", + "glob", + "meta", + "package_config", + "path", + "pub_semver", + "source_span", + "watcher", + "yaml" + ] + }, + { + "name": "_fe_analyzer_shared", + "version": "109.0.0", + "dependencies": [ + "meta" + ] + }, + { + "name": "pub_semver", + "version": "2.2.1", + "dependencies": [ + "collection" + ] + }, + { + "name": "watcher", + "version": "1.2.1", + "dependencies": [ + "async", + "path" + ] + }, + { + "name": "crypto", + "version": "3.0.7", + "dependencies": [ + "typed_data" + ] + }, + { + "name": "shelf", + "version": "1.4.3", + "dependencies": [ + "async", + "collection", + "http_parser", + "path", + "stack_trace", + "stream_channel" + ] + }, + { + "name": "web_socket_channel", + "version": "3.0.3", + "dependencies": [ + "async", + "crypto", + "stream_channel", + "web", + "web_socket" + ] + }, + { + "name": "web_socket", + "version": "1.0.1", + "dependencies": [ + "web" + ] + }, + { + "name": "web", + "version": "1.1.1", + "dependencies": [] + }, + { + "name": "vm_service", + "version": "15.4.0", + "dependencies": [] + } + ], + "configVersion": 1 +} \ No newline at end of file diff --git a/dart/leap/.dart_tool/pub/bin/test/test.dart-3.11.0.snapshot b/dart/leap/.dart_tool/pub/bin/test/test.dart-3.11.0.snapshot new file mode 100644 index 0000000..9f9e6a9 Binary files /dev/null and b/dart/leap/.dart_tool/pub/bin/test/test.dart-3.11.0.snapshot differ diff --git a/dart/leap/.dart_tool/test/incremental_kernel.Ly9AZGFydD0zLjI= b/dart/leap/.dart_tool/test/incremental_kernel.Ly9AZGFydD0zLjI= new file mode 100644 index 0000000..745a534 Binary files /dev/null and b/dart/leap/.dart_tool/test/incremental_kernel.Ly9AZGFydD0zLjI= differ diff --git a/dart/leap/.exercism/config.json b/dart/leap/.exercism/config.json new file mode 100644 index 0000000..4135808 --- /dev/null +++ b/dart/leap/.exercism/config.json @@ -0,0 +1,27 @@ +{ + "authors": [ + "SuperPaintman" + ], + "contributors": [ + "jvarness", + "Stargator", + "kytrinyx" + ], + "files": { + "solution": [ + "lib/leap.dart" + ], + "test": [ + "test/leap_test.dart" + ], + "example": [ + ".meta/lib/example.dart" + ], + "invalidator": [ + "pubspec.yaml" + ] + }, + "blurb": "Determine whether a given year is a leap year.", + "source": "CodeRanch Cattle Drive, Assignment 3", + "source_url": "https://web.archive.org/web/20240907033714/https://coderanch.com/t/718816/Leap" +} diff --git a/dart/leap/.exercism/metadata.json b/dart/leap/.exercism/metadata.json new file mode 100644 index 0000000..3f0e14f --- /dev/null +++ b/dart/leap/.exercism/metadata.json @@ -0,0 +1 @@ +{"track":"dart","exercise":"leap","id":"86add6a25fe54052987310d5c9191d4f","url":"https://exercism.org/tracks/dart/exercises/leap","handle":"sanctushck","is_requester":true,"auto_approve":false} \ No newline at end of file diff --git a/dart/leap/HELP.md b/dart/leap/HELP.md new file mode 100644 index 0000000..73de501 --- /dev/null +++ b/dart/leap/HELP.md @@ -0,0 +1,61 @@ +# Help + +## Correr os testes + +Instala as dependências. + +```sh +dart pub get +``` + +Corre os testes. + +```sh +dart test +``` + +Para obteres uma saída mais detalhada por teste, usa o relator expandido. + +```sh +dart test -r expanded +``` + +A maioria dos exercícios tem vários testes, e todos exceto o primeiro são ignorados por defeito. +Para fazeres os testes um a um, altera `skip: true` para `skip: false` em cada teste à medida que avanças. + +Em alternativa, corre todos os testes de uma só vez sem editares o ficheiro. + +```sh +dart test --run-skipped +``` + +Todos os testes são executados pelo executor de testes online ao submeteres, incluindo os ignorados. + +## Submeter a tua solução + +Podes submeter a tua solução com o comando `exercism submit lib/leap.dart`. +Este comando envia a tua solução para o site do Exercism e imprime o URL da página da solução. + +É possível submeter uma solução incompleta, o que te permite: + +- Ver como outras pessoas resolveram o exercício +- Pedir ajuda a um mentor + +## Precisas de ajuda? + +Se quiseres ajuda para resolver o exercício, consulta as seguintes páginas: + +- A [documentação do percurso Dart](https://exercism.org/docs/tracks/dart) +- A [categoria de programação do percurso Dart no fórum](https://forum.exercism.org/c/programming/dart) +- A [categoria de programação do Exercism no fórum](https://forum.exercism.org/c/programming/5) +- As [Perguntas Frequentes](https://exercism.org/docs/using/faqs) + +Se esses recursos não forem suficientes, podes submeter a tua solução (incompleta) para pedir mentoria. + +Se tiveres dificuldades e precisares de ajuda, podes recorrer a um destes recursos: + +- [Documentação da API do Dart](https://api.dart.dev/) +- [Chat do Dart no Gitter](https://gitter.im/dart-lang/home) +- [Informações da comunidade](https://www.dart.dev/community) +- O [/r/dartlang](https://www.reddit.com/r/dartlang) é o subreddit do Dart. +- O [StackOverflow](https://stackoverflow.com/questions/tagged/dart) pode ser usado para procurar o teu problema e ver se já foi respondido. Também podes fazer e responder a perguntas. \ No newline at end of file diff --git a/dart/leap/README.md b/dart/leap/README.md new file mode 100644 index 0000000..1bdb7d2 --- /dev/null +++ b/dart/leap/README.md @@ -0,0 +1,41 @@ +# Ano bissexto + +Bem-vindo ao Ano bissexto no percurso Dart do Exercism. +Se precisares de ajuda para correr os testes ou para submeter o teu código, consulta o `HELP.md`. + +## Introduction + +Um ano bissexto (no calendário gregoriano) ocorre: + +- Em todos os anos divisíveis por 4. +- Exceto quando o ano é divisível por 100; nesse caso, só é bissexto se também for divisível por 400. + +Alguns exemplos: + +- 1997 não foi um ano bissexto, porque não é divisível por 4. +- 1900 não foi um ano bissexto, porque não é divisível por 400. +- 2000 foi um ano bissexto! + +~~~~exercism/note +Para uma explicação encantadora de quatro minutos sobre todo o fenómeno dos anos bissextos, vê [este vídeo do YouTube](https://www.youtube.com/watch?v=xX96xng7sAE). +~~~~ + +## Instructions + +A tua tarefa é determinar se um dado ano é bissexto. + +## Source + +### Created by + +- @SuperPaintman + +### Contributed to by + +- @jvarness +- @Stargator +- @kytrinyx + +### Based on + +CodeRanch Cattle Drive, Assignment 3 - https://web.archive.org/web/20240907033714/https://coderanch.com/t/718816/Leap \ No newline at end of file diff --git a/dart/leap/analysis_options.yaml b/dart/leap/analysis_options.yaml new file mode 100644 index 0000000..c06363d --- /dev/null +++ b/dart/leap/analysis_options.yaml @@ -0,0 +1,18 @@ +analyzer: + strong-mode: + implicit-casts: false + implicit-dynamic: false + errors: + unused_element: error + unused_import: error + unused_local_variable: error + dead_code: error + +linter: + rules: + # Error Rules + - avoid_relative_lib_imports + - avoid_types_as_parameter_names + - literal_only_boolean_expressions + - no_adjacent_strings_in_list + - valid_regexps diff --git a/dart/leap/lib/leap.dart b/dart/leap/lib/leap.dart new file mode 100644 index 0000000..c91a0a0 --- /dev/null +++ b/dart/leap/lib/leap.dart @@ -0,0 +1,5 @@ +class Leap { + bool leapYear(int year) { + return ((year % 4) == 0 && ((year % 400 == 0) || (year % 100 != 0))); + } +} diff --git a/dart/leap/pubspec.lock b/dart/leap/pubspec.lock new file mode 100644 index 0000000..d789a76 --- /dev/null +++ b/dart/leap/pubspec.lock @@ -0,0 +1,397 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "48e48f73a431eb269eec66d243a63a07ed90ef9417a74047a3b98d52338626ad" + url: "https://pub.dev" + source: hosted + version: "109.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "6d377901d198536b648172974d9d4f277910502cad92193466869cac0ff34990" + url: "https://pub.dev" + source: hosted + version: "14.5.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + cli_config: + dependency: transitive + description: + name: cli_config + sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec + url: "https://pub.dev" + source: hosted + version: "0.2.0" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: "89b8801ba49f8b593fbf2d3e59efd0f566c46cd4ba6837ae2610c72b52a0f899" + url: "https://pub.dev" + source: hosted + version: "0.6.0" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: ff89e37c19355194e279d26dafe8e4bece46c9ea63a30be4dc68214f5bc290d3 + url: "https://pub.dev" + source: hosted + version: "1.16.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "404dbf9bce29beafbe9dcb19219447b6f7d49900cd42b8d3b7af102b24508e25" + url: "https://pub.dev" + source: hosted + version: "4.1.0" + glob: + dependency: transitive + description: + name: glob + sha256: "218aeb56050c714f62a3182775320dfa04602b55074873e24e31bbd39bda96fb" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "361668bdd71f0ae2dc6d17b75a593520f3c414af6534f9eed1aa72049dd71d18" + url: "https://pub.dev" + source: hosted + version: "3.2.3" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + io: + dependency: transitive + description: + name: io + sha256: "2635216ca6a737e60de577ffa1a48a0bec76ca8a62917cfc1bb88c14c570646f" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" + url: "https://pub.dev" + source: hosted + version: "0.12.20" + meta: + dependency: transitive + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + mime: + dependency: transitive + description: + name: mime + sha256: bd47de35f07e27267e69c8c8b22edf9473bfee170a60d60fcc93730c5144b7f6 + url: "https://pub.dev" + source: hosted + version: "2.1.0" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: ffcf4cf3d6c0b74ac43708d9f56625506e8a68aa935abe9d267a7330f320eb5d + url: "https://pub.dev" + source: hosted + version: "3.0.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + pool: + dependency: transitive + description: + name: pool + sha256: "4177f68c237ea2128d1bee66ac17b2ce05ba3dbaafcbdd54c5d40a39d0b6b11c" + url: "https://pub.dev" + source: hosted + version: "1.5.3" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + shelf: + dependency: transitive + description: + name: shelf + sha256: e75e9cf311d7fd712048038cc17c25199c38536c20330d53e7db058b543d5a48 + url: "https://pub.dev" + source: hosted + version: "1.4.3" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: "480504af9e5323899c5be26a4f6c2fc4437d50954d39842f0290f4ae733d57b4" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "14c2945847669b44089bb1222f66873d7ff7103c58911917f2a63c5a62327898" + url: "https://pub.dev" + source: hosted + version: "0.10.14" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test: + dependency: "direct dev" + description: + name: test + sha256: "44b2fccf4407bcdb5e105c064c5d6b5e2a640c87761f8b03cdce8cf532d98cfa" + url: "https://pub.dev" + source: hosted + version: "1.33.0" + test_api: + dependency: transitive + description: + name: test_api + sha256: "47481c58bb92d0b1d218f0510ff5647e768f8e1256d07077a151fb520923b51d" + url: "https://pub.dev" + source: hosted + version: "0.7.15" + test_core: + dependency: transitive + description: + name: test_core + sha256: "9dec4c178bd61493e1cd2060ffe701fcb61c43da2493e99590fb1b0cc82eb4af" + url: "https://pub.dev" + source: hosted + version: "0.6.21" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "89b11d62e1040ee681af3b4f1c97a803ecbf010c6e8b9c5896ee5b08c3bf7b78" + url: "https://pub.dev" + source: hosted + version: "15.4.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea + url: "https://pub.dev" + source: hosted + version: "3.1.4" +sdks: + dart: ">=3.11.0 <4.0.0" diff --git a/dart/leap/pubspec.yaml b/dart/leap/pubspec.yaml new file mode 100644 index 0000000..e16b7e3 --- /dev/null +++ b/dart/leap/pubspec.yaml @@ -0,0 +1,5 @@ +name: 'leap' +environment: + sdk: '>=3.2.0 <4.0.0' +dev_dependencies: + test: '<2.0.0' diff --git a/dart/leap/test/leap_test.dart b/dart/leap/test/leap_test.dart new file mode 100644 index 0000000..61d1c2e --- /dev/null +++ b/dart/leap/test/leap_test.dart @@ -0,0 +1,53 @@ +import 'package:leap/leap.dart'; +import 'package:test/test.dart'; + +void main() { + final leap = Leap(); + + group('Leap', () { + test('year not divisible by 4 in common year', () { + final result = leap.leapYear(2015); + expect(result, equals(false)); + }, skip: false); + + test('year divisible by 2, not divisible by 4 in common year', () { + final result = leap.leapYear(1970); + expect(result, equals(false)); + }, skip: false); + + test('year divisible by 4, not divisible by 100 in leap year', () { + final result = leap.leapYear(1996); + expect(result, equals(true)); + }, skip: false); + + test('year divisible by 4 and 5 is still a leap year', () { + final result = leap.leapYear(1960); + expect(result, equals(true)); + }, skip: false); + + test('year divisible by 100, not divisible by 400 in common year', () { + final result = leap.leapYear(2100); + expect(result, equals(false)); + }, skip: false); + + test('year divisible by 100 but not by 3 is still not a leap year', () { + final result = leap.leapYear(1900); + expect(result, equals(false)); + }, skip: false); + + test('year divisible by 400 is leap year', () { + final result = leap.leapYear(2000); + expect(result, equals(true)); + }, skip: false); + + test('year divisible by 400 but not by 125 is still a leap year', () { + final result = leap.leapYear(2400); + expect(result, equals(true)); + }, skip: false); + + test('year divisible by 200, not divisible by 400 in common year', () { + final result = leap.leapYear(1800); + expect(result, equals(false)); + }, skip: false); + }); +} diff --git a/dart/two-fer/.dart_tool/test/incremental_kernel.Ly9AZGFydD0zLjI= b/dart/two-fer/.dart_tool/test/incremental_kernel.Ly9AZGFydD0zLjI= index 2eff150..a3f1687 100644 Binary files a/dart/two-fer/.dart_tool/test/incremental_kernel.Ly9AZGFydD0zLjI= and b/dart/two-fer/.dart_tool/test/incremental_kernel.Ly9AZGFydD0zLjI= differ