From 39a144c85aa4229345463280d4f61266350a6527 Mon Sep 17 00:00:00 2001 From: Andinus Date: Wed, 8 Sep 2021 22:26:42 +0530 Subject: Raku: Acronym: Add solution --- raku/acronym/acronym.rakutest | 89 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 raku/acronym/acronym.rakutest (limited to 'raku/acronym/acronym.rakutest') diff --git a/raku/acronym/acronym.rakutest b/raku/acronym/acronym.rakutest new file mode 100644 index 0000000..fad0fe4 --- /dev/null +++ b/raku/acronym/acronym.rakutest @@ -0,0 +1,89 @@ +#!/usr/bin/env raku +use Test; +use JSON::Fast; +use lib $?FILE.IO.dirname; +use Acronym; +plan 9; + +my @test-cases = from-json($=pod[*-1].contents).List; +for @test-cases -> %case { + is abbreviate(%case), |%case; +} + +=head2 Test Cases +=begin code +[ + { + "description": "basic", + "expected": "PNG", + "input": { + "phrase": "Portable Network Graphics" + }, + "property": "abbreviate" + }, + { + "description": "lowercase words", + "expected": "ROR", + "input": { + "phrase": "Ruby on Rails" + }, + "property": "abbreviate" + }, + { + "description": "punctuation", + "expected": "FIFO", + "input": { + "phrase": "First In, First Out" + }, + "property": "abbreviate" + }, + { + "description": "all caps word", + "expected": "GIMP", + "input": { + "phrase": "GNU Image Manipulation Program" + }, + "property": "abbreviate" + }, + { + "description": "punctuation without whitespace", + "expected": "CMOS", + "input": { + "phrase": "Complementary metal-oxide semiconductor" + }, + "property": "abbreviate" + }, + { + "description": "very long abbreviation", + "expected": "ROTFLSHTMDCOALM", + "input": { + "phrase": "Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me" + }, + "property": "abbreviate" + }, + { + "description": "consecutive delimiters", + "expected": "SIMUFTA", + "input": { + "phrase": "Something - I made up from thin air" + }, + "property": "abbreviate" + }, + { + "description": "apostrophes", + "expected": "HC", + "input": { + "phrase": "Halley's Comet" + }, + "property": "abbreviate" + }, + { + "description": "underscore emphasis", + "expected": "TRNT", + "input": { + "phrase": "The Road _Not_ Taken" + }, + "property": "abbreviate" + } +] +=end code -- cgit 1.4.1-2-gfad0