Skip to content

Commit

Permalink
dart/pangram: download exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Apr 24, 2024
1 parent a48ec27 commit 22371cf
Show file tree
Hide file tree
Showing 8 changed files with 192 additions and 0 deletions.
25 changes: 25 additions & 0 deletions dart/pangram/.exercism/config.json
Original file line number Diff line number Diff line change
@@ -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"
}
1 change: 1 addition & 0 deletions dart/pangram/.exercism/metadata.json
Original file line number Diff line number Diff line change
@@ -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}
38 changes: 38 additions & 0 deletions dart/pangram/HELP.md
Original file line number Diff line number Diff line change
@@ -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.
44 changes: 44 additions & 0 deletions dart/pangram/README.md
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions dart/pangram/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions dart/pangram/lib/pangram.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Pangram {
// Put your code here
}
5 changes: 5 additions & 0 deletions dart/pangram/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: 'pangram'
environment:
sdk: '>=3.2.0 <4.0.0'
dev_dependencies:
test: '<2.0.0'
58 changes: 58 additions & 0 deletions dart/pangram/test/pangram_test.dart
Original file line number Diff line number Diff line change
@@ -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);
});
}

0 comments on commit 22371cf

Please sign in to comment.