-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding writeSupport for yUnit fields (#82)
Co-authored-by: magnaw <[email protected]>
- Loading branch information
1 parent
53380b5
commit 6f7c192
Showing
2 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
namespace SpaFileReader.Tests; | ||
|
||
public class WriterTest | ||
{ | ||
private readonly byte[] _bytes; | ||
private readonly byte[] _noInterferogramBytes; | ||
|
||
public WriterTest() | ||
{ | ||
_bytes = File.ReadAllBytes(TestFile("test1.spa")); | ||
_noInterferogramBytes = File.ReadAllBytes(TestFile("test2.spa")); | ||
} | ||
|
||
[Fact] | ||
public void WriteYUnitAsBytesTest() | ||
{ | ||
var convertedSpa = SpaFile.WriteYUnitAsSpanByte(_bytes, SpaFile.ReadYUnitAsSpanByte(_noInterferogramBytes)); | ||
var spaToWrite = SpaFile.ReadYUnitAsFloatArray(_noInterferogramBytes); | ||
var writtenSpa = SpaFile.ReadYUnitAsFloatArray(convertedSpa.ToArray()); | ||
Assert.Equal(spaToWrite, writtenSpa); | ||
} | ||
|
||
[Fact] | ||
public void WriteYUnitAsFloatsTest() | ||
{ | ||
var convertedSpa = SpaFile.WriteYUnitAsSpanFloat( _bytes, SpaFile.ReadYUnitAsFloatArray(_noInterferogramBytes)); | ||
var spaToWrite = SpaFile.ReadYUnitAsFloatArray(_noInterferogramBytes); | ||
var writtenSpa = SpaFile.ReadYUnitAsFloatArray(convertedSpa.ToArray()); | ||
Assert.Equal(spaToWrite, writtenSpa); | ||
} | ||
|
||
|
||
} |