From 22371cfd2a2c365bcd3ffdaf1c34b488b00c3323 Mon Sep 17 00:00:00 2001 From: Victor Payno Date: Tue, 23 Apr 2024 20:35:03 -0700 Subject: [PATCH] dart/pangram: download exercise --- dart/pangram/.exercism/config.json | 25 ++++++++++++ dart/pangram/.exercism/metadata.json | 1 + dart/pangram/HELP.md | 38 ++++++++++++++++++ dart/pangram/README.md | 44 +++++++++++++++++++++ dart/pangram/analysis_options.yaml | 18 +++++++++ dart/pangram/lib/pangram.dart | 3 ++ dart/pangram/pubspec.yaml | 5 +++ dart/pangram/test/pangram_test.dart | 58 ++++++++++++++++++++++++++++ 8 files changed, 192 insertions(+) create mode 100644 dart/pangram/.exercism/config.json create mode 100644 dart/pangram/.exercism/metadata.json create mode 100644 dart/pangram/HELP.md create mode 100644 dart/pangram/README.md create mode 100644 dart/pangram/analysis_options.yaml create mode 100644 dart/pangram/lib/pangram.dart create mode 100644 dart/pangram/pubspec.yaml create mode 100644 dart/pangram/test/pangram_test.dart diff --git a/dart/pangram/.exercism/config.json b/dart/pangram/.exercism/config.json new file mode 100644 index 00000000..459cac30 --- /dev/null +++ b/dart/pangram/.exercism/config.json @@ -0,0 +1,25 @@ +{ + "authors": [ + "amscotti" + ], + "contributors": [ + "kytrinyx" + ], + "files": { + "solution": [ + "lib/pangram.dart" + ], + "test": [ + "test/pangram_test.dart" + ], + "example": [ + ".meta/lib/example.dart" + ], + "invalidator": [ + "pubspec.yaml" + ] + }, + "blurb": "Determine if a sentence is a pangram.", + "source": "Wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Pangram" +} diff --git a/dart/pangram/.exercism/metadata.json b/dart/pangram/.exercism/metadata.json new file mode 100644 index 00000000..bcc4d3ec --- /dev/null +++ b/dart/pangram/.exercism/metadata.json @@ -0,0 +1 @@ +{"track":"dart","exercise":"pangram","id":"6f8307447ae444d893b03797f16baae2","url":"https://exercism.org/tracks/dart/exercises/pangram","handle":"vpayno","is_requester":true,"auto_approve":false} \ No newline at end of file diff --git a/dart/pangram/HELP.md b/dart/pangram/HELP.md new file mode 100644 index 00000000..25f04a9c --- /dev/null +++ b/dart/pangram/HELP.md @@ -0,0 +1,38 @@ +# Help + +## Running the tests + +To run the tests: + +```sh +$ dart test +``` + +## Submitting your solution + +You can submit your solution using the `exercism submit lib/pangram.dart` 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 [Dart track's documentation](https://exercism.org/docs/tracks/dart) +- The [Dart track's programming category on the forum](https://forum.exercism.org/c/programming/dart) +- [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. + +To get help if you're having trouble, you can use one of the following resources: + +- [Dart API Documentation](https://api.dart.dev/) +- [Dart Gitter Chat](https://gitter.im/dart-lang/home) +- [Community Information](https://www.dart.dev/community) +- [/r/dartlang](https://www.reddit.com/r/dartlang) is the Dart subreddit. +- [StackOverflow](https://stackoverflow.com/questions/tagged/dart) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions. \ No newline at end of file diff --git a/dart/pangram/README.md b/dart/pangram/README.md new file mode 100644 index 00000000..2748dd9d --- /dev/null +++ b/dart/pangram/README.md @@ -0,0 +1,44 @@ +# Pangram + +Welcome to Pangram on Exercism's Dart Track. +If you need help running the tests or submitting your code, check out `HELP.md`. + +## Introduction + +You work for a company that sells fonts through their website. +They'd like to show a different sentence each time someone views a font on their website. +To give a comprehensive sense of the font, the random sentences should use **all** the letters in the English alphabet. + +They're running a competition to get suggestions for sentences that they can use. +You're in charge of checking the submissions to see if they are valid. + +~~~~exercism/note +Pangram comes from Greek, παν γράμμα, pan gramma, which means "every letter". + +The best known English pangram is: + +> The quick brown fox jumps over the lazy dog. +~~~~ + +## Instructions + +Your task is to figure out if a sentence is a pangram. + +A pangram is a sentence using every letter of the alphabet at least once. +It is case insensitive, so it doesn't matter if a letter is lower-case (e.g. `k`) or upper-case (e.g. `K`). + +For this exercise, a sentence is a pangram if it contains each of the 26 letters in the English alphabet. + +## Source + +### Created by + +- @amscotti + +### Contributed to by + +- @kytrinyx + +### Based on + +Wikipedia - https://en.wikipedia.org/wiki/Pangram \ No newline at end of file diff --git a/dart/pangram/analysis_options.yaml b/dart/pangram/analysis_options.yaml new file mode 100644 index 00000000..c06363d6 --- /dev/null +++ b/dart/pangram/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/pangram/lib/pangram.dart b/dart/pangram/lib/pangram.dart new file mode 100644 index 00000000..1faa6825 --- /dev/null +++ b/dart/pangram/lib/pangram.dart @@ -0,0 +1,3 @@ +class Pangram { + // Put your code here +} diff --git a/dart/pangram/pubspec.yaml b/dart/pangram/pubspec.yaml new file mode 100644 index 00000000..8f838a6a --- /dev/null +++ b/dart/pangram/pubspec.yaml @@ -0,0 +1,5 @@ +name: 'pangram' +environment: + sdk: '>=3.2.0 <4.0.0' +dev_dependencies: + test: '<2.0.0' diff --git a/dart/pangram/test/pangram_test.dart b/dart/pangram/test/pangram_test.dart new file mode 100644 index 00000000..3eb09af5 --- /dev/null +++ b/dart/pangram/test/pangram_test.dart @@ -0,0 +1,58 @@ +import 'package:pangram/pangram.dart'; +import 'package:test/test.dart'; + +void main() { + final pangram = Pangram(); + + group('Pangram', () { + test('empty sentence', () { + final result = pangram.isPangram(''); + expect(result, equals(false)); + }, skip: false); + + test('perfect lower case', () { + final result = pangram.isPangram('abcdefghijklmnopqrstuvwxyz'); + expect(result, equals(true)); + }, skip: true); + + test('only lower case', () { + final result = pangram.isPangram('the quick brown fox jumps over the lazy dog'); + expect(result, equals(true)); + }, skip: true); + + test('missing the letter \'x\'', () { + final result = pangram.isPangram('a quick movement of the enemy will jeopardize five gunboats'); + expect(result, equals(false)); + }, skip: true); + + test('missing the letter \'h\'', () { + final result = pangram.isPangram('five boxing wizards jump quickly at it'); + expect(result, equals(false)); + }, skip: true); + + test('with underscores', () { + final result = pangram.isPangram('the_quick_brown_fox_jumps_over_the_lazy_dog'); + expect(result, equals(true)); + }, skip: true); + + test('with numbers', () { + final result = pangram.isPangram('the 1 quick brown fox jumps over the 2 lazy dogs'); + expect(result, equals(true)); + }, skip: true); + + test('missing letters replaced by numbers', () { + final result = pangram.isPangram('7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog'); + expect(result, equals(false)); + }, skip: true); + + test('mixed case and punctuation', () { + final result = pangram.isPangram('"Five quacking Zephyrs jolt my wax bed."'); + expect(result, equals(true)); + }, skip: true); + + test('a-m and A-M are 26 different characters but not a pangram', () { + final result = pangram.isPangram('abcdefghijklm ABCDEFGHIJKLM'); + expect(result, equals(false)); + }, skip: true); + }); +}