diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-12-01 13:33:34 +0100 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-12-01 13:33:34 +0100 |
commit | c8bf38e5fb717d40635a2a89b22ed71b0de4266b (patch) | |
tree | 63751b2f5497c6f99e1c6a78f23a8e6e5c49833f /tests/tdiff.cpp |
Squashed 'dependencies/uthash/' content from commit 8e67ced
git-subtree-dir: dependencies/uthash
git-subtree-split: 8e67ced1d1c5bd8141c542a22630e6de78aa6b90
Diffstat (limited to 'tests/tdiff.cpp')
-rw-r--r-- | tests/tdiff.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/tdiff.cpp b/tests/tdiff.cpp new file mode 100644 index 000000000..4be14fed6 --- /dev/null +++ b/tests/tdiff.cpp @@ -0,0 +1,34 @@ +// Windows does not have unix diff so this is a simple replacement +#include <iostream> +#include <fstream> +using namespace std; +int main(int argc, char *argv[] ) { + int rc=-1; + if (argc != 3) { + cout << "usage: " << argv[0] << " file1 file2\n"; + return -1; + } + char *file1 = argv[1]; + char *file2 = argv[2]; + ifstream is1(file1, ios::in); + ifstream is2(file2, ios::in); + if (is1.fail()) {cerr << "failed to open " << file1 << "\n"; goto done;} + if (is2.fail()) {cerr << "failed to open " << file2 << "\n"; goto done;} + char d1[256], d2[256]; + do { + is1.read(d1,sizeof(d1)); + is2.read(d2,sizeof(d2)); + if ((is1.gcount() != is2.gcount()) || memcmp(d1,d2,is1.gcount())) { + cout << file1 << " and " << file2 << " differ\n"; + goto done; + } + } while (!is1.eof() && !is2.eof()); + + rc=0; + + done: + is1.close(); + is2.close(); + return rc; +} + |