007ff5448db77afee468aaf82d37a58ed0a72dbe
1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 import test_deserialization
16 import binary
::serialization
17 #alt1# import test_deserialization_serial
19 var entities
= new TestEntities
21 var tests
= entities
.without_generics
#alt1#
22 #alt1#var tests = entities.with_generics
24 var dir
= "out/test_binary_deserialization"
25 if not dir
.file_exists
then dir
.mkdir
27 var path
= dir
/ "alt0"#alt1#
28 #alt1#var path = dir / "alt1"
30 var writer
= new FileWriter.open
(path
)
31 var serializer
= new BinarySerializer(writer
)
33 serializer
.serialize o
37 var reader
= new FileReader.open
(path
)
38 var deserializer
= new BinaryDeserializer(reader
)
40 var dst
= deserializer
.deserialize
43 assert o
.is_same_type
(dst
)
46 print
"# Dst:\n{dst}\n"