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.180 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.179 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.178 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.177 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.176 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.175 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.174 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.173 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.172 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.171 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.170 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.169 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.167 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.166 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.165 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.164 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.163 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.162 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.161 tracks/perl6/exercises/acronym/acronym.t
trackler-2.2.1.160 tracks/perl6/exercises/acronym/acronym.t