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.159 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.158 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.157 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.156 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.155 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.154 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.153 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.152 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.151 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.150 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.149 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.148 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.147 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.146 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.145 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.144 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.143 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.142 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.141 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.140 tracks/perl6/exercises/acronym/acronym.t