1#!/usr/bin/perl 2use strict; 3use warnings; 4use Test::More tests => 7; 5BEGIN { use_ok('aggregate') } 6require_ok('aggregate'); 7 8# adapted from ../java/aggregate_runme.java 9 10# Confirm that move() returns correct results under normal use 11is(aggregate::move($aggregate::UP), $aggregate::UP, "UP"); 12 13is(aggregate::move($aggregate::DOWN), $aggregate::DOWN, "DOWN"); 14 15is(aggregate::move($aggregate::LEFT), $aggregate::LEFT, "LEFT"); 16 17is(aggregate::move($aggregate::RIGHT), $aggregate::RIGHT, "RIGHT"); 18 19# Confirm that move() raises an exception when the contract is violated 20eval { aggregate::move(0) }; 21like($@, qr/\bRuntimeError\b/); 22 23