0030964: Data Exchange - use Standard_ReadLineBuffer within OBJ reader
[occt.git] / tests / de_mesh / stl_read / D1
CommitLineData
22e70738 1puts "\n#======================================================================"
2puts "# Check reading empty or small STL files"
3puts "#======================================================================\n"
4
5set minimal_ascii_stl {solid
6facet normal 0 0 1
7outer loop
8vertex 0 0 0
9vertex 1 0 0
10vertex 0 1 0
11endloop
12endfacet
13endsolid}
14
15puts "\n#======================================================================"
16puts "# Ascii file with single facet, CRLF"
17puts "#======================================================================"
18set fd [open ${imagedir}/${casename}_one_ascii_dos.stl w]
19fconfigure $fd -translation crlf
20puts $fd $minimal_ascii_stl
21close $fd
4c4420df 22readstl res_one_ascii_dos ${imagedir}/${casename}_one_ascii_dos.stl -brep
22e70738 23checknbshapes res_one_ascii_dos -face 1
24
25puts "\n#======================================================================"
26puts "# Ascii file with single facet, LF"
27puts "#======================================================================"
28set fd [open ${imagedir}/${casename}_one_ascii_unix.stl w]
29fconfigure $fd -translation lf
30puts $fd $minimal_ascii_stl
31close $fd
4c4420df 32readstl res_one_ascii_unix ${imagedir}/${casename}_one_ascii_unix.stl -brep
22e70738 33checknbshapes res_one_ascii_unix -face 1
34
35puts "\n#======================================================================"
36puts "# Ascii file with single facet, LF, no EOL at the last line"
37puts "#======================================================================"
38set fd [open ${imagedir}/${casename}_one_ascii_noeol.stl w]
39fconfigure $fd -translation lf
40puts -nonewline $fd $minimal_ascii_stl
41close $fd
4c4420df 42readstl res_one_ascii_noeol ${imagedir}/${casename}_one_ascii_noeol.stl -brep
22e70738 43checknbshapes res_one_ascii_noeol -face 1
44
45puts "\n#======================================================================"
46puts "# Ascii file with no facets, CRLF"
47puts "#======================================================================"
48set fd [open ${imagedir}/${casename}_zero_ascii_dos.stl w]
49fconfigure $fd -translation crlf
50puts $fd "solid \nendsolid"
51close $fd
4c4420df 52readstl res_zero_ascii_dos ${imagedir}/${casename}_zero_ascii_dos.stl -brep
22e70738 53
54puts "\n#======================================================================"
55puts "# Ascii file with no facets, LF"
56puts "#======================================================================"
57set fd [open ${imagedir}/${casename}_zero_ascii_unix.stl w]
58fconfigure $fd -translation lf
59puts $fd "solid \nendsolid"
60close $fd
4c4420df 61readstl res_zero_ascii_unix ${imagedir}/${casename}_zero_ascii_unix.stl -brep
22e70738 62
63puts "\n#======================================================================"
64puts "# Binary file with single facet"
65puts "#======================================================================"
66set fd [open ${imagedir}/${casename}_one_binary.stl w]
67fconfigure $fd -translation binary
68puts -nonewline $fd "stl [string repeat { } 76]"
69puts -nonewline $fd [binary format if3f3f3f3t 1 {0 0 1} {0 0 0} {1 0 0} {0 1 0} 0]
70close $fd
4c4420df 71readstl res_one_binary ${imagedir}/${casename}_one_binary.stl -brep
22e70738 72checknbshapes res_one_binary -face 1
73
74puts "\n#======================================================================"
75puts "# Binary file with no facets -- will be treated as Ascii and generate e r r o r"
76puts "#======================================================================"
51ee6a7d 77puts "REQUIRED ALL: Error: premature end of file"
22e70738 78set fd [open ${imagedir}/${casename}_zero_binary.stl w]
79fconfigure $fd -translation binary
80puts -nonewline $fd "stl [string repeat { } 76][binary format i 0]"
81close $fd
4c4420df 82readstl res_zero_binary ${imagedir}/${casename}_zero_binary.stl -brep
22e70738 83
84puts "\n#======================================================================"
85puts "# Empty file"
86puts "#======================================================================"
51ee6a7d 87puts "REQUIRED ALL: Error: premature end of file"
22e70738 88set fd [open ${imagedir}/${casename}_empty.stl w]
89close $fd
4c4420df 90readstl res_empty ${imagedir}/${casename}_empty.stl -brep
22e70738 91