[SOLVED] CS # -*- perl -*-

$25

File Name: CS_#_-*-_perl_-*-.zip
File Size: 160.14 KB

5/5 - (1 vote)

# -*- perl -*-

# The expected output looks like this:
#
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#
# A different permutation of 015 is acceptable, but every line must
# be in the same order.

use strict;
use warnings;
use tests::tests;

our ($test);
my (@output) = read_text_file ($test.output);

common_checks (run, @output);

my ($thread_cnt) = 16;
my ($iter_cnt) = 16;
my (@order);
my (@t) = (-1) x $thread_cnt;

my (@iterations) = grep (/iteration:/, @output);
fail No iterations found in output.
if !@iterations;

my (@numbering) = $iterations[0] =~ /(d+)/g;
fail First iteration does not list exactly $thread_cnt threads.

if @numbering != $thread_cnt;

my (@sorted_numbering) = sort { $a <=> $b } @numbering;
for my $i (0$#sorted_numbering) {
if ($sorted_numbering[$i] != $i) {
fail First iteration does not list all threads
. 0$#sorted_numbering
;
}
}

for my $i (1$#iterations) {
if ($iterations[$i] ne $iterations[0]) {
fail Iteration $i differs from iteration 0
;
}
}

fail $iter_cnt iterations expected but . scalar (@iterations). found

if $iter_cnt != @iterations;

pass;

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS # -*- perl -*-
$25