read_bytes.c

ds2.10/fluffos-2.16-ds05/testsuite/single/tests/efuns/read_bytes.c · 713 B

From the archive ds2.10.zip

Download the archive   « Back to the archive contents

void do_tests() {
    string foo = read_file("/testfile");

    ASSERT(!read_bytes("/does_not_exist"));
    ASSERT(!read_bytes("/does_not_exist", 1));
    ASSERT(!read_bytes("/does_not_exist", 1, 2));

    ASSERT(!read_bytes("/testfile", -100000, 10));
    ASSERT(read_bytes("/testfile", -10, 5) == foo[<10..<6]);
    ASSERT(read_bytes("/testfile", -10, 0) == foo[<10..]);
    ASSERT(read_bytes("/testfile", -10) == foo[<10..]);
    ASSERT(read_bytes("/testfile", -10, 100) == foo[<10..]);
    ASSERT(read_bytes("/testfile") == foo);
    ASSERT(!read_bytes("/testfile", 1000000, 10));
    ASSERT(read_bytes("/testfile", 100, 100) == foo[100..199]);
    ASSERT(strlen(read_bytes("/testfile", 100, 100)) == 100);
}

Site Stats

Snippets: 1791
Codebases: 571