[t][TT #1122] Convert t/op/numbert.t to PIR, mgrimes++
[parrot.git] / t / pmc / schedulermessage.t
blobef2b8b61df3613410ad00382ce048500a9e73107
1 #! parrot
2 # Copyright (C) 2008, Parrot Foundation.
3 # $Id$
5 =head1 NAME
7 t/pmc/schedulermessage - test the SchedulerMessage PMC
9 =head1 SYNOPSIS
11     % prove t/pmc/schedulermessage.t
13 =head1 DESCRIPTION
15 Tests the SchedulerMessage PMC.
17 =cut
19 .sub main :main
20     .include 'test_more.pir'
22     plan(7)
24     init_check()
25     type_and_id_tests()
26     freeze_thaw_tests()
27     hash_tests()
28 .end
30 .sub init_check
31     new $P0, ['SchedulerMessage']
32     ok(1, 'Instantiated SchedulerMessage PMC')
33 .end
35 .sub type_and_id_tests
36     $P0 = new ['SchedulerMessage']
37     $P0 = 2345
38     $P0 = "some kinda message"
40     $S0 = $P0
41     is($S0 , "some kinda message", "scheduler message type stored/retrieved successfully")
43     $I0 = $P0
44     is($I0, 2345, "scheduler id type stored/retrieved successfully")
46 .end
48 .sub freeze_thaw_tests
49     $P0 = new ['SchedulerMessage']
50     $P0 = 86
51     $P0 = "Smart message"
53     $S0 = freeze $P0
54     $P1 = thaw $S0
56     $S0 = $P1
57     is($S0, "Smart message", "frozen message has correct type")
59     $I0 = $P1
60     is($I0, 86, "frozen message has correct id")
62 .end
65 .sub hash_tests
66     $P0 = new ['Hash']
67     $P0['id'] = 9
68     $P0['type'] = 'nine'
70     $P1 = new ['SchedulerMessage'], $P0
72     $S0 = $P1
73     is($S0, "nine", "hash-initialized message has correct type")
75     $I0 = $P1
76     is($I0, 9, "hash-initialized message has correct id")
77 .end
79 # Local Variables:
80 #   mode: pir
81 #   fill-column: 100
82 # End:
83 # vim: expandtab shiftwidth=4 ft=pir: