I just found a tool that can tell whether two files share the same physical blocks: https://github.com/dyorgio/apfs-clone-checker
$ gcc clone_checker.c -o clone_checker
$ chmod +x clone_checker
$ ls
LICENSE
README.md
clone_checker
clone_checker.c
# normal copy
$ cp README.md README.copy.md
# use copyfile
$ cp -c README.md README.clone.md
$ ./clone_checker README.md README.copy.md
0
$ ./clone_checker README.md README.clone.md
1
# make some changes
$ vi README.clone.md
$ ./clone_checker README.md README.clone.md
0
It could be used to test the clone function.
I just found a tool that can tell whether two files share the same physical blocks: https://github.com/dyorgio/apfs-clone-checker
It could be used to test the clone function.