<commit_before>#-*- mode: cperl -*-#
use strict;
use warnings;
use Test::More tests => 5;

BEGIN { use_ok('JSON::Schema::Naive') }

my $s = JSON::Schema::Naive->new;

$s->schema(
    {
        type  => "object",
        query => {
            beef => {
                type     => "integer",
                required => 1,
                minimum  => 5,
                maximum  => 9
            },
            cake => {
                type     => "string",
                required => 1
            },
            bucket => {
                type => "string"
            }
        }
    }
);

# $JSON::Schema::Naive::DEBUG=1;

ok( $s->validate( { beef => 5, cake => "cake" } ), "query valid" );

ok( ! $s->validate( { beef => 3, bucket => "burp" } ), "query invalid" );
like( (sort $s->errors)[0], qr('beef' cannot be less than), "integer minimum" );
like( (sort $s->errors)[1], qr('cake' is required), "required" );

exit;<commit_msg>- another test<commit_after>#-*- mode: cperl -*-#
use strict;
use warnings;
use Test::More tests => 6;

BEGIN { use_ok('JSON::Schema::Naive') }

my $s = JSON::Schema::Naive->new;

$s->schema(
    {
        type  => "object",
        query => {
            beef => {
                type     => "integer",
                required => 1,
                minimum  => 5,
                maximum  => 9
            },
            cake => {
                type     => "string",
                required => 1
            },
            bucket => {
                type => "string"
            }
        }
    }
);

# $JSON::Schema::Naive::DEBUG=1;

ok( $s->validate( { beef => 5, cake => "cake" } ), "query valid" );

ok( ! $s->validate( { beef => 3, bucket => "burp" } ), "query invalid" );
like( (sort $s->errors)[0], qr('beef' cannot be less than), "integer minimum" );
like( (sort $s->errors)[1], qr('cake' is required), "required" );

$s->schema(
    {
        type  => "object",
        query => {
            bucket => {
                type => "string"
            }
        }
    }
);

# $JSON::Schema::Naive::DEBUG=1;

ok( $s->validate( { bucket => "cards" } ), "query valid" );

exit;
{'fraction_non_alphanumeric': 0.1952941176470588, 'fraction_numerical': 0.00988235294117647, 'mean_word_length': 1.5583634175691938, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 56, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4355113', 'n_tokens_mistral': 707, 'n_tokens_neox': 669, 'n_words': 161}