| 1864 | } |
| 1865 | |
| 1866 | static bool sp_stdout_file_equals(const char *path, const void *bytes, size_t count) { |
| 1867 | FILE *file = cbm_fopen(path, "rb"); |
| 1868 | if (!file) |
| 1869 | return false; |
| 1870 | const unsigned char *expected = bytes; |
| 1871 | bool equal = true; |
| 1872 | for (size_t i = 0; i < count; i++) { |
| 1873 | int byte = fgetc(file); |
| 1874 | if (byte == EOF || (unsigned char)byte != expected[i]) { |
| 1875 | equal = false; |
| 1876 | break; |
| 1877 | } |
| 1878 | } |
| 1879 | if (equal) |
| 1880 | equal = fgetc(file) == EOF && !ferror(file); |
| 1881 | if (fclose(file) != 0) |
| 1882 | equal = false; |
| 1883 | return equal; |
| 1884 | } |
| 1885 | |
| 1886 | typedef struct { |
| 1887 | char lines[4][64]; |
no test coverage detected