ref: 8f6bfd8f7bf8c5ca162bdf49a94570e21e03ba3a
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")
}