summaryrefslogtreecommitdiffstats
path: root/bank-eiffel/tests/test_person.e
blob: 01e9a50a28cecd74722bb215daecc3210920b90a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
class
	TEST_PERSON

inherit
	EQA_TEST_SET

feature -- Test routines
	CREATE_EDIT_PERSON
		local
			person: PERSON
			student: STUDENT
			retiree: RETIREE
		do
			create person.make("SOME_SURNAME_1", "SOME_FIRSTNAME_1")
			assert("CREATE_EDIT_PERSON_FIRSTNAME_1", person.firstname.is_equal("SOME_FIRSTNAME_1"))
			assert("CREATE_EDIT_PERSON_SURNAME_1", person.surname.is_equal("SOME_SURNAME_1"))

			person.firstname := "SOME_FIRSTNAME_2"
			assert("CREATE_EDIT_PERSON_FIRSTNAME_2", person.firstname.is_equal("SOME_FIRSTNAME_2"))
			person.surname := "SOME_SURNAME_2"
			assert("CREATE_EDIT_PERSON_SURNAME_2", person.surname.is_equal("SOME_SURNAME_2"))

			create student.make ("STUDENT_SURNAME", "STUDENT_FIRSTNAME")
			assert("CREATE_EDIT_PERSON_STUDENT", attached {PERSON} student)
			create retiree.make ("RETIREE_SURNAME", "RETIREE_FIRSTNAME")
			assert("CREATE_EDIT_PERSON_RETIREE", attached {PERSON} student)
		end

	PERSON_EMPTY_SURNAME
		local
			person: PERSON
			retry_count: INTEGER
		do
			inspect retry_count
			when 0 then
				create person.make("", "SOME_FIRSTNAME")
				assert("PERSON_EMPTY_SURNAME_1", False)
			when 1 then
				create person.make("SOME_SURNAME", "SOME_FIRSTNAME")
				person.surname := ""
				assert("PERSON_EMPTY_SURNAME_3", False)
			else
			end
		rescue
			if not (create {EXCEPTIONS}).is_developer_exception then
				retry_count := retry_count + 1
				retry
			end
		end

	PERSON_EMPTY_FIRSTNAME
		local
			person: PERSON
			retry_count: INTEGER
		do
			inspect retry_count
			when 0 then
				create person.make("SOME_SURNAME", "")
				assert("PERSON_EMPTY_FIRSTNAME_1", False)
			when 1 then
				create person.make("SOME_SURNAME", "SOME_FIRSTNAME")
				person.firstname := ""
				assert("PERSON_EMPTY_FIRSTNAME_3", False)
			else
			end
		rescue
			if not (create {EXCEPTIONS}).is_developer_exception then
				retry_count := retry_count + 1
				retry
			end
		end
end