Class-CompiledC

 view release on metacpan or  search on metacpan

t/Class-CompiledC.t  view on Meta::CPAN

   'abc', 
   'test __circumPrint simple');
is(Class::CompiledC::__circumPrint('b', 'a', 'c', 'd'),   
   'abc', 
   'test __circumPrint extra parameter');
is(Class::CompiledC::__circumPrint(2, 1, 3),              
   '123', 
   'test __circumPrint numeric parameters');
is(Class::CompiledC::__circumPrint(dualvar (1, 'b'), 'a', 'c'),   
   'abc', 
   'test __circumPrint daulvar\'ed parameter');

is(Class::CompiledC::__circumPrint('b' x 500, 'a' x 500, 'c' x 500),   
   ('a' x 500).('b' x 500).('c' x 500), 
   'test __circumPrint large parameters');


is(Class::CompiledC::__fetchSymbolName(\*FOO), 'FOO', 
   '__fetchSymbolName positive');

dies_with
{
        Class::CompiledC::__fetchSymbolName(\&FOO),
} qr/not a glob reference/i, '__fetchSymbolName negative (coderef)';

dies_with
{
        Class::CompiledC::__fetchSymbolName(1),
} qr/not a glob reference/i, '__fetchSymbolName negative (number)';

dies_with
{
        Class::CompiledC::__fetchSymbolName('foobar'),
} qr/not a glob reference/i, '__fetchSymbolName negative (string)';

dies_with
{
        Class::CompiledC::__fetchSymbolName([]),
} qr/not a glob reference/i, '__fetchSymbolName negative (arrayref)';

dies_with
{
        Class::CompiledC::__fetchSymbolName({}),
} qr/not a glob reference/i, '__fetchSymbolName negative (hashref)';

dies_with
{
        Class::CompiledC::__fetchSymbolName(\$$),
} qr/not a glob reference/i, '__fetchSymbolName negative (scalarref)';

dies_with
{
        Class::CompiledC::__fetchSymbolName(qr/foo/),
} qr/not a glob reference/i, '__fetchSymbolName negative (regexref)';

dies_with
{
        Class::CompiledC::__fetchSymbolName(bless [], 'foobar'),
} qr/not a glob reference/i, '__fetchSymbolName negative (blessed reference)';

is (Class::CompiledC::__promoteFieldTypeToMacro('FOO'), 
    '__CHECK(__ISFOO(__ARG0), "FOO")',
    '__promoteFieldTypeToMacro simple test');

is (Class::CompiledC::__promoteFieldTypeToMacro('fOoBaR'), 
    '__CHECK(__ISFOOBAR(__ARG0), "fOoBaR")',
    '__promoteFieldTypeToMacro case test');

is (Class::CompiledC::__promoteFieldTypeToMacro('any'), 
    '',
    '__promoteFieldTypeToMacro any test');

is (Class::CompiledC::__parseFieldType('Isa(FOO)'),
    '__CHECK(__ISA(__ARG0, "FOO"), "__ISA")',
    '__parseFieldType isa test');

is (Class::CompiledC::__parseFieldType('int'), 
    '__CHECK(__ISINT(__ARG0), "int")',
    '__parseFieldType int test');

is (Class::CompiledC::__parseFieldType('float'), 
    '__CHECK(__ISFLOAT(__ARG0), "float")',
    '__parseFieldType float test');

is (Class::CompiledC::__parseFieldType('number'), 
    '__CHECK(__ISNUMBER(__ARG0), "number")',
    '__parseFieldType number test');

is (Class::CompiledC::__parseFieldType('string'), 
    '__CHECK(__ISSTRING(__ARG0), "string")',
    '__parseFieldType string test');

is (Class::CompiledC::__parseFieldType('ref'), 
    '__CHECK(__ISREF(__ARG0), "ref")',
    '__parseFieldType ref test');

is (Class::CompiledC::__parseFieldType('arrayref'), 
    '__CHECK(__ISARRAYREF(__ARG0), "arrayref")',
    '__parseFieldType arrayref test');

is (Class::CompiledC::__parseFieldType('hashref'), 
    '__CHECK(__ISHASHREF(__ARG0), "hashref")',
    '__parseFieldType hashref test');

is (Class::CompiledC::__parseFieldType('coderef'), 
    '__CHECK(__ISCODEREF(__ARG0), "coderef")',
    '__parseFieldType coderef test');

is (Class::CompiledC::__parseFieldType('object'), 
    '__CHECK(__ISOBJECT(__ARG0), "object")',
    '__parseFieldType object test');

is (Class::CompiledC::__parseFieldType('regexpref'), 
    '__CHECK(__ISREGEXPREF(__ARG0), "regexpref")',
    '__parseFieldType regexpref test');

is (Class::CompiledC::__parseFieldType('any'), 
    '',
    '__parseFieldType any test');

is (Class::CompiledC::__parseFieldType('uint'), 
    '__CHECK(__ISUINT(__ARG0), "uint")',
    '__parseFieldType uint test');
    
dies_with
{
        Class::CompiledC::__parseFieldType('bad field type')
} qr/fail0r: bad type specified/i, '__parseFieldType unknown field test';


BEGIN



( run in 1.019 second using v1.01-cache-2.11-cpan-e1769b4cff6 )