Testing data exchange functionality

Not sure if I have gotten the logic right
in all cases.
Ignore lib/
for loop init declaration requires C99
Merge pull request #2 from ekfriis/master

Add tests of data exchange functionality