-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test/lib_f_mv: start to test file processing function: f_mv()
working on github issue: <#45>
- Loading branch information
Showing
4 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "bbs.h" | ||
#include <string.h> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
printf("\x1b[1;33mCopying %s to %s ....\x1b[0m\n",argv[1],argv[2]); | ||
f_mv(argv[1],argv[2]); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
set -eux | ||
|
||
################### test f_mv() | ||
touch before.txt | ||
printf "putsometextin" >> before.txt | ||
test "$(uname -o)" = "GNU/Linux" && sha256_before=$(sha256sum before.txt |awk '{print $1}') | ||
test "$(uname -o)" = "FreeBSD" && sha256_before=$(sha256 before.txt |awk '{print $1}') | ||
./lib_f_mv before.txt after.txt | ||
test "$(uname -o)" = "GNU/Linux" && sha256_after=$(sha256sum after.txt |awk '{print $1}') | ||
test "$(uname -o)" = "FreeBSD" && sha256_after=$(sha256 after.txt |awk '{print $1}') | ||
test "$sha256_before" = "$sha256_after" && printf "\033[1;32mtest f_mv done ok!\033[0m\n" | ||
rm after.txt |