public void reads_large_uints() { Stream s2 = new FileStream("fixtures/input_stream_parser/large_uint.txt", FileMode.Open, FileAccess.Read); InputStreamParser p2 = new InputStreamParser(s2); for (uint i = 1; i <= 10000000; i *= 10) { Specify.That(p2.read_uint()).ShouldEqual(i); } }
public void ensures_read_uint_does_not_read_chars() { MethodThatThrows mtt = delegate() { Stream s3 = new FileStream("fixtures/input_stream_parser/no_uint.txt", FileMode.Open, FileAccess.Read); InputStreamParser p3 = new InputStreamParser(s3); p3.read_uint(); }; Specify.ThrownBy(mtt).ShouldBeOfType(typeof(FormatException)); }
public void read_one_word_space_delimited() { Stream s = new FileStream("fixtures/input_stream_parser/uint_space_delimited.txt", FileMode.Open, FileAccess.Read); InputStreamParser p = new InputStreamParser(s); for (uint i = 0; i < 10; ++i) { Specify.That(p.read_uint()).ShouldEqual(i); } Specify.That(p.is_eof()).ShouldBeTrue(); }
public void reads_uint_line_delimited() { Stream s4 = new FileStream("fixtures/input_stream_parser/uint_line_delimited.txt", FileMode.Open, FileAccess.Read); InputStreamParser p4 = new InputStreamParser(s4); for (uint i = 0; i < 10; ++i) { Specify.That(p4.read_uint()).ShouldEqual(i); } }