MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / fixture_file_matches

Function fixture_file_matches

tests/test_pipeline.c:17867–17889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17865}
17866
17867static bool fixture_file_matches(const char *path, const char *expected) {
17868 FILE *file = cbm_fopen(path, "rb");
17869 if (!file) {
17870 return false;
17871 }
17872 char actual[1024];
17873 size_t expected_length = strlen(expected);
17874 size_t offset = 0;
17875 size_t bytes = 0;
17876 bool matched = true;
17877 while ((bytes = fread(actual, 1, sizeof(actual), file)) != 0) {
17878 if (bytes > expected_length - offset || memcmp(actual, expected + offset, bytes) != 0) {
17879 matched = false;
17880 break;
17881 }
17882 offset += bytes;
17883 }
17884 matched = matched && !ferror(file) && feof(file) && offset == expected_length;
17885 if (fclose(file) != 0) {
17886 matched = false;
17887 }
17888 return matched;
17889}
17890
17891/* #2034: no manual mkdir may make an absent deep fixture look indexed. */
17892TEST(pipeline_nested_fixture_files_are_written) {

Callers 1

test_pipeline.cFile · 0.85

Calls 2

cbm_fopenFunction · 0.85
freadFunction · 0.85

Tested by

no test coverage detected