Sha256: 8d24333630b23183c6bb2ff2acb438185c79a12b0bc7513f1f9a8fb27c988df4

Contents?: true

Size: 1.68 KB

Versions: 78

Compression:

Stored size: 1.68 KB

Contents

#!/usr/bin/env perl6
use v6;
use Test;
use JSON::Fast;
use lib $?FILE.IO.dirname;
use Acronym;
plan 5;

my Version:D $version = v2;

if Acronym.^ver !~~ $version {
  warn "\nExercise version mismatch. Further tests may fail!"
    ~ "\nAcronym is {Acronym.^ver.gist}. "
    ~ "Test is {$version.gist}.\n";
}

my $c-data = from-json $=pod.pop.contents;

for $c-data<cases>»<cases>».Array.flat {
  is abbreviate(.<input><phrase>), |.<expected description>;
}

=head2 Canonical Data
=begin code
{
  "exercise": "acronym",
  "version": "1.3.0",
  "cases": [
    {
      "description": "Abbreviate a phrase",
      "cases": [
        {
          "description": "basic",
          "property": "abbreviate",
          "input": {
            "phrase": "Portable Network Graphics"
          },
          "expected": "PNG"
        },
        {
          "description": "lowercase words",
          "property": "abbreviate",
          "input": {
            "phrase": "Ruby on Rails"
          },
          "expected": "ROR"
        },
        {
          "description": "punctuation",
          "property": "abbreviate",
          "input": {
            "phrase": "First In, First Out"
          },
          "expected": "FIFO"
        },
        {
          "description": "all caps word",
          "property": "abbreviate",
          "input": {
            "phrase": "GNU Image Manipulation Program"
          },
          "expected": "GIMP"
        },
        {
          "description": "punctuation without whitespace",
          "property": "abbreviate",
          "input": {
            "phrase": "Complementary metal-oxide semiconductor"
          },
          "expected": "CMOS"
        }
      ]
    }
  ]
}
=end code

Version data entries

78 entries across 78 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.138 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.137 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.136 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.135 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.134 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.133 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.132 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.131 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.130 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.129 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.128 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.127 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.126 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.125 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.124 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.123 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.122 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.121 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.120 tracks/perl6/exercises/acronym/acronym.t