### ----------------------------------------------------
### -- ValueType
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use ValueType;

plan 3;

class Point does ValueType {
    has $.x = 0;
    has $.y = 0;
    has $!distance is hidden-from-ValueType;
}

is-deeply Point.new.WHICH, ValueObjAt.new("Point|Int|0|Int|0"),
  'is the basic .WHICH ok';

my $bag = bag (^1000).map: {
    Point.new: x => (-10..10).roll, y => (-10..10).roll
}

ok $bag.elems < 1000, 'should be fewer than 1000 different points';

dies-ok { 'class A does ValueType { has $.a is rw }'.EVAL },
  'cannot have "is rw" attributes in value types';

# vim: expandtab shiftwidth=4


