Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add yacht exercise #691

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Add yacht exercise #691

wants to merge 2 commits into from

Conversation

glennj
Copy link
Contributor

@glennj glennj commented Nov 13, 2024

No description provided.

@m-dango
Copy link
Member

m-dango commented Nov 18, 2024

I want to have a think about this one for the categories arg, wondering if there's a better option than a string (thinking about how its done in Raku and Python)

@kotp kotp marked this pull request as draft November 18, 2024 16:59
@glennj
Copy link
Contributor Author

glennj commented Nov 18, 2024

Perhaps something like

package Yacht::Categories;

# exports ...

use constant {
    ONES => 1,
    TWOS => 2,
    # ...
    CHOICE => 12,
};

Or, do away with the category argument, and the generator calls a subroutine named after the category:

subs: ones twos ... choice
properties:
   score:
     test: |-
       use Data::Dmp;
       (my $name = $case->{input}{category}) =~ s/ /_/g;
       sprintf(<<'END', $name, dmp($case->{input}{dice}), $case->{expected}, dmp($case->{description}));
       is(
           %s(%s),
           %s,
           %s,
       );
       END

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants