ref: f1558a33e06a7b344cac9a351f2879c2f881b28e
dir: /test/bio-endianrd.myr/
use std use bio const main = { var b : byte var w : uint16 var l : uint32 var q : uint64 var f /* use the expected write data as read data */ match bio.open("data/bio-endianwr-expected", bio.Rd) | `std.Some bio: f = bio | `std.None: std.fatal(1, "Unable to open data file") ;; /* byte */ /* /* FIXME: compiler bug. multiplication on byte values is currently broken. */ b = 0xaa std.assert(bio.getle(f) == b, "le byte broken\n") std.assert(bio.getbe(f) == b, "be byte broken\n") */ /* word */ w = 0xaabb std.assert(bio.getle(f) == w, "le word broken\n") std.assert(bio.getbe(f) == w, "be word broken\n") /* long */ l = 0xaabbccdd std.assert(bio.getle(f) == l, "le long broken\n") std.assert(bio.getbe(f) == l, "be long broken\n") /* quad */ q = 0x11223344aabbccdd castto(uint64) std.assert(bio.getle(f) == q, "le quad broken\n") std.assert(bio.getbe(f) == q, "be quad broken\n") /* and test for flush on close */ bio.close(f); std.put("success: all reads matched\n") }