2013-07-24 12:06:17 -07:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
2016-05-16 06:07:57 -07:00
|
|
|
use Test::Deep;
|
2013-07-24 12:06:17 -07:00
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
|
|
|
zci answer_type => 'guid';
|
|
|
|
zci is_cached => 0;
|
|
|
|
|
2016-05-15 16:16:03 -07:00
|
|
|
sub build_structured_answer {
|
|
|
|
return re(qr/^([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}$/),
|
|
|
|
structured_answer => {
|
|
|
|
data => {
|
|
|
|
title => re(qr/^([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}$/),
|
|
|
|
subtitle => 'Random GUID',
|
|
|
|
},
|
|
|
|
templates => {
|
|
|
|
group => 'text',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2014-01-21 16:37:13 -08:00
|
|
|
|
2016-05-16 09:53:38 -07:00
|
|
|
sub build_test {
|
|
|
|
return test_zci(build_structured_answer());
|
|
|
|
}
|
|
|
|
|
2014-10-15 06:46:02 -07:00
|
|
|
ddg_goodie_test([qw( DDG::Goodie::GUID ) ],
|
2014-01-21 16:37:13 -08:00
|
|
|
|
2014-10-15 06:46:02 -07:00
|
|
|
# Check that the trigger kicks in.
|
2016-05-16 09:53:38 -07:00
|
|
|
'guid' => build_test(),
|
|
|
|
'uuid' => build_test(),
|
|
|
|
'globally unique identifier' => build_test(),
|
|
|
|
'rfc 4122' => build_test(),
|
|
|
|
'new guid' => build_test(),
|
|
|
|
'random uuid' => build_test(),
|
|
|
|
'generate new uuid' => build_test(),
|
|
|
|
'generate random uuid' => build_test(),
|
2014-12-24 08:13:35 -08:00
|
|
|
'uuid in ansi C' => undef,
|
|
|
|
'what is a guid' => undef,
|
2013-07-24 12:06:17 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
done_testing;
|