/[eiffelstudio]/branches/eth/eve/Src/library/abel/apps/test/abel_test/ps_experiments.e
ViewVC logotype

Contents of /branches/eth/eve/Src/library/abel/apps/test/abel_test/ps_experiments.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 89142 - (show annotations)
Wed Jul 18 17:15:12 2012 UTC (7 years, 3 months ago) by romanschmocker
File size: 3838 byte(s)
Small fix to make an experiment pass instead of fail
1 note
2 description: "Some experiments done during the development of ABEL."
3 author: "Roman Schmocker"
4 date: "$Date$"
5 revision: "$Revision$"
6
7 class
8 PS_EXPERIMENTS
9
10 inherit
11
12 EQA_TEST_SET
13
14 feature
15
16 internal_test
17 -- An experiment about the runtime attached/detachable type situation
18 local
19 reflection: INTERNAL
20 ref1: REFERENCE_CLASS_1
21 list: LINKED_LIST [REFERENCE_CLASS_1]
22 i: INTEGER
23 do
24 create reflection
25 create ref1.make (1)
26 check attached {REFERENCE_CLASS_1} reflection.new_instance_of (reflection.detachable_type (reflection.dynamic_type (ref1))) as ref2 and attached {REFERENCE_CLASS_1} reflection.new_instance_of (reflection.attached_type (reflection.dynamic_type (ref1))) as ref3 then
27 from
28 i := 1
29 until
30 i > reflection.field_count (ref2)
31 loop
32 if reflection.field_name (i, ref2).is_case_insensitive_equal ("ref_class_id") then
33 reflection.set_integer_32_field (i, ref2, 1)
34 reflection.set_integer_32_field (i, ref3, 1)
35 elseif reflection.field_name (i, ref2).is_case_insensitive_equal ("references") then
36 create list.make
37 reflection.set_reference_field (i, ref2, list)
38 create list.make
39 reflection.set_reference_field (i, ref3, list)
40 end
41 i := i + 1
42 end
43 -- print (ref2.tagged_out + ref3.tagged_out)
44 assert ("both_types_detachable", ref1.is_deep_equal (ref2))
45 assert ("attached_and_detachable_wont_work", not ref1.is_deep_equal (ref3))
46 end
47 end
48
49 internal_special_experiment
50 local
51 person_special: SPECIAL [PERSON]
52 ref_special: SPECIAL [REFERENCE_CLASS_1]
53 detached_ref_special: SPECIAL [detachable REFERENCE_CLASS_1]
54 generated_special: ANY
55 reflection: INTERNAL
56 do
57 create reflection
58 create person_special.make_empty (10)
59 create ref_special.make_empty (10)
60 print (reflection.dynamic_type (person_special).out + "%N")
61 print (reflection.dynamic_type (ref_special).out + "%N")
62 print (reflection.generic_dynamic_type (person_special, 1).out + "%N")
63 print (reflection.generic_dynamic_type (ref_special, 1).out + "%N")
64 --generated_special:= reflection.new_special_any_instance (reflection.generic_dynamic_type (person_special, 1), 10)
65 generated_special := reflection.new_special_any_instance (reflection.dynamic_type (person_special), 10)
66 print (reflection.dynamic_type (generated_special).out + "%N")
67 print (generated_special.is_deep_equal (person_special))
68 print (person_special.out)
69 print (ref_special.out)
70 create detached_ref_special.make_filled (Void, 10)
71 print (detached_ref_special.out)
72 end
73
74 test_generic_objects_type
75 local
76 list: LIST [ANY]
77 do
78 create {LINKED_LIST [ANY]} list.make
79 print (attached {LIST [PERSON]} list)
80 list.extend (create {PERSON}.make ("a", "b", 0))
81 print (attached {LIST [PERSON]} list)
82 end
83
84 test_sqlite_failure_for_multiple_open_connections
85 local
86 conn1, conn2: detachable SQLITE_DATABASE
87 file: STRING
88 retried: BOOLEAN
89 do
90 if not retried then
91 file := "test.db"
92 create conn1.make_create_read_write (file)
93 create conn2.make_create_read_write (file)
94 conn1.begin_transaction (False)
95 conn2.begin_transaction (False)
96 end
97 rescue
98 check attached conn2 as c and then attached c.last_exception as ex then
99 print (ex.meaning)
100 end
101 retried:= True
102 retry
103 end
104
105 test_constant_initialized
106 local
107 reflection: INTERNAL
108 test_obj: ANY
109 i: INTEGER
110 do
111 create reflection
112 test_obj := reflection.new_instance_of (reflection.dynamic_type_from_string ("ESCHER_TEST_CLASS"))
113 from
114 i := 1
115 until
116 i > reflection.field_count (test_obj)
117 loop
118 print (reflection.field (i, test_obj))
119 i := i + 1
120 end
121 check attached {VERSIONED_CLASS} test_obj as escher_obj then
122 assert ("version not correct", escher_obj.version = 3)
123 end
124 end
125
126 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23