Commit ae5ef676 authored by Per Cederqvist's avatar Per Cederqvist

Lots of test cases added. Still only tests creation and get-text-stat.

parent 2bdc29ee
import string
class factory:
def __init__(self, bcc_trigg, bcc_visible, other_trigg, other_visible):
def __init__(self, bcc_trigg, bcc_visible, other_trigg, other_visible, rd):
self.__bcc_trigg = bcc_trigg
self.__bcc_visible = bcc_trigg + bcc_visible
self.__other_trigg = bcc_trigg + other_trigg
......@@ -9,6 +9,7 @@ class factory:
for n in bcc_visible:
if n not in self.__other_visible:
self.__other_visible.append(n)
self.__readable = bcc_trigg + other_trigg + rd
def create(self, misc, conf, loc):
if misc == 15:
......@@ -17,16 +18,17 @@ class factory:
else:
trigg = self.__other_trigg
visib = self.__other_visible
return misc_group(misc, conf, loc, trigg, visib)
return misc_group(misc, conf, loc, trigg, visib, self.__readable)
class misc_group:
def __init__(self, misc, conf, loc, trigg, visib):
def __init__(self, misc, conf, loc, trigg, visib, readable):
self.__misc = misc
self.__conf = conf
self.__loc = loc
self.__trigg = trigg
self.__visib = visib
self.__readable = readable
def miscs(self, viewer, rec_time = None, sent_by = None, sent_at = None):
if viewer not in self.__visib:
......@@ -44,14 +46,56 @@ class misc_group:
def trigger(self, viewer):
return viewer in self.__trigg
def readable(self, viewer):
return viewer in self.__readable
# (creator, recipient): trigger-bcc, trigger-other, is-visible-for
# (creator, recipient): bcc-trigg, bcc-vis, other-trigg, other-vis, rd
obj = {
(6, 6): factory([6], [], [], [7, 8, 9]),
(6, 7): factory([7], [6], [], [8, 9]),
(6, 8): factory([8], [6], [], [7, 9]),
(6, 9): factory([9], [6], [], [7, 8]),
(6, 10): factory([7, 8], [6], [], [9]),
(6, 6): factory([6], [], [], [7, 8, 9], []),
(6, 7): factory([], [6, 7], [], [8, 9], [7]),
(6, 8): factory([8], [6], [], [7, 9], []),
(6, 9): factory([9], [6], [], [7, 8], []),
(6, 10): factory([7, 8], [6, 9], [], [], [6, 9]),
(6, 11): factory([7, 8], [6], [], [9], []),
(6, 12): factory([7, 8], [6], [], [9], []),
(6, 13): factory([7, 8], [6, 9], [], [], [6, 9]),
(6, 14): factory([7, 8], [6, 9], [], [], [9]),
(6, 15): factory([7, 8], [6, 9], [], [], [9]),
(7, 6): factory([6], [7], [], [8, 9], []),
(7, 7): factory([], [7], [], [6, 8, 9], [7]),
(7, 8): factory([8], [7], [], [6, 7, 9], []),
(7, 9): factory([9], [7], [], [6, 7, 8], []),
(7, 10): factory([7, 8], [6, 9], [], [], [6, 9]),
(7, 11): factory([7, 8], [], [], [6, 9], []),
(7, 12): factory([7, 8], [], [], [], []),
(7, 13): factory([7, 8], [6, 9], [], [], [6, 9]),
(7, 14): factory([7, 8], [9], [], [6], [9]),
(7, 15): factory([7, 8], [9], [], [], [9]),
(8, 6): factory([6], [8], [], [7, 9], []),
(8, 7): factory([], [7, 8], [], [6, 9], [7]),
(8, 8): factory([8], [], [], [6, 7, 9], []),
(8, 9): factory([9], [8], [], [6, 7], []),
(8, 10): factory([7, 8], [6, 9], [], [], [6, 9]),
(8, 11): factory([7, 8], [], [], [6, 9], []),
(8, 12): factory([7, 8], [], [], [], []),
(8, 13): factory([7, 8], [6, 9], [], [], [6, 9]),
(8, 14): factory([7, 8], [9], [], [6], [9]),
(8, 15): factory([7, 8], [9], [], [], [9]),
(9, 6): factory([6], [9], [], [7, 8], []),
(9, 7): factory([], [7, 9], [], [6, 8], [7]),
(9, 8): factory([8], [9], [], [6, 7], []),
(9, 9): factory([9], [], [], [6, 7, 8], []),
(9, 10): factory([7, 8], [6, 9], [], [], [6, 9]),
(9, 11): factory([7, 8], [9], [], [], []),
(9, 12): factory([7, 8], [9], [], [], []),
(9, 13): factory([7, 8], [6, 9], [], [], [6, 9]),
(9, 14): factory([7, 8], [9], [], [6], [9]),
(9, 15): factory([7, 8], [9], [], [], [9]),
}
class loc_no_allocator:
......@@ -99,6 +143,22 @@ def create(author, recipients):
new_text(author, tx, misc)
talk_to(author)
print "simple_expect \"=%d %d\"" % (cs, tx)
for p in PERSONS:
talk_to(p)
print "send \"%d 90 %d\\n\"" % (ref.next(), tx)
visib = p == author
pattern = []
for m in misc:
pattern = pattern + m.miscs(p)
if m.readable(p):
visib = 1
if visib:
print "simple_expect \"=%d $any_time " \
"%d 0 %d 0 %d { %s } 0 \\\\\\*\"" % (
ref.curr, author, len("text %d" % tx),
len(pattern), string.join(pattern, " "))
else:
print "simple_expect \"%%%d 14 %d\"" % (ref.curr, tx)
return (tx, misc)
PERSONS = range(6, 10)
......@@ -117,7 +177,7 @@ def new_text(author, txt, misc):
"%d 0 %d 0 %d { %s } 0 \\\\\\*\"" % (
txt, author, len("text %d" % txt),
len(pattern), string.join(pattern, " "))
else:
elif author != viewer:
talk_to(viewer)
print "send \"%d 35\\n\"" % ref.next()
print "simple_expect \"=%d $any_time\"" % ref.curr
......@@ -182,5 +242,10 @@ def disco():
print "lyskomd_death"
setup()
create(6, [(0, 6)])
for author in [6, 7, 8, 9]:
for misc in [0, 1, 15]:
for rcpt in [6, 7, 8, 9, 10, 11, 12, 13, 14, 15]:
if author in [6, 9] and rcpt in [12, 15]:
continue
create(author, [(misc, rcpt)])
disco()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment