-
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.
Merge pull request #3 from LaneDibello/master
Update fork master
- Loading branch information
Showing
32 changed files
with
1,853 additions
and
527 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using KotOR_IO; | ||
|
||
namespace FieldTypeTests | ||
{ | ||
[TestClass] | ||
public class ByteTests | ||
{ | ||
[TestMethod] | ||
public void TestMethod1() | ||
{ | ||
} | ||
} | ||
} |
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,59 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using KotOR_IO; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace FileFormatTests | ||
{ | ||
[TestClass] | ||
public class BIFTests | ||
{ | ||
/// <summary> | ||
/// Verify that BIF.ToRawData() returns an array of data with equivalent length to the | ||
/// data used to construct the BIF object. | ||
/// </summary> | ||
[TestMethod] | ||
public void ToRawData_SimpleRead_SizeUnchanged() | ||
{ | ||
// Arrange | ||
var fileToRead = @"C:\Program Files (x86)\Steam\steamapps\common\swkotor\data\templates.bif"; | ||
var oldFileInfo = new FileInfo(fileToRead); | ||
long oldSize = oldFileInfo.Length; | ||
BIF bif = new BIF(fileToRead); | ||
|
||
// Act | ||
var rawData = bif.ToRawData(); | ||
|
||
// Assert | ||
long newSize = rawData.Length; | ||
Assert.AreEqual(oldSize, newSize, "Size of raw data has changed."); | ||
} | ||
|
||
/// <summary> | ||
/// Verify that BIF.WriteToFile() creates a data file of equivalent size to the file | ||
/// used to construct the BIF object. | ||
/// </summary> | ||
[TestMethod] | ||
public void WriteToFile_ValidPath_SizeUnchanged() | ||
{ | ||
// Arrange | ||
var pathToRead = @"C:\Program Files (x86)\Steam\steamapps\common\swkotor\data\templates.bif"; | ||
var pathToWrite = Environment.CurrentDirectory + "templates_copy.bif"; | ||
var oldFileInfo = new FileInfo(pathToRead); | ||
long oldSize = oldFileInfo.Length; | ||
BIF bif = new BIF(pathToRead); | ||
|
||
// Act | ||
bif.WriteToFile(pathToWrite); | ||
var newFileInfo = new FileInfo(pathToWrite); | ||
|
||
// Assert | ||
long newSize = newFileInfo.Length; | ||
Assert.AreEqual(oldSize, newSize, "Size of raw data has changed."); | ||
|
||
// Cleanup | ||
File.Delete(pathToWrite); | ||
} | ||
} | ||
} |
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,60 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using KotOR_IO; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace FileFormatTests | ||
{ | ||
[TestClass] | ||
public class GFFTests | ||
{ | ||
/// <summary> | ||
/// Verify that GFF.ToRawData() returns an array of data with equivalent length to the | ||
/// data used to construct the GFF object. | ||
/// </summary> | ||
[TestMethod] | ||
public void ToRawData_SimpleRead_SizeUnchanged() | ||
{ | ||
// Arrange | ||
var fileToRead = @"C:\Program Files (x86)\Steam\steamapps\common\swkotor\data\templates.bif"; | ||
BIF templates = new BIF(fileToRead); | ||
var vre = templates.VariableResourceTable.First(vre => vre.ResourceType == ResourceType.UTC); | ||
int oldSize = vre.EntryData.Length; | ||
GFF utc = new GFF(vre.EntryData); | ||
|
||
// Act | ||
var rawData = utc.ToRawData(); | ||
|
||
// Assert | ||
int newSize = rawData.Length; | ||
Assert.AreEqual(oldSize, newSize, "Size of raw data has changed."); | ||
} | ||
|
||
/// <summary> | ||
/// Verify that GFF.WriteToFile() creates a data file of equivalent size to the file | ||
/// used to construct the GFF object. | ||
/// </summary> | ||
[TestMethod] | ||
public void WriteToFile_ValidPath_SizeUnchanged() | ||
{ | ||
// Arrange | ||
string pathToRead = @"C:\Dev\KIO Test\test1.git"; | ||
string pathToWrite = @"C:\Dev\KIO Test\test1_copy.git"; | ||
FileInfo oldFileInfo = new FileInfo(pathToRead); | ||
GFF gff = new GFF(pathToRead); | ||
|
||
// Act | ||
gff.WriteToFile(pathToWrite); | ||
FileInfo newFileInfo = new FileInfo(pathToWrite); | ||
|
||
// Assert | ||
var oldFileSize = oldFileInfo.Length; | ||
var newFileSize = newFileInfo.Length; | ||
Assert.AreEqual(oldFileSize, newFileSize, "File size has changed."); | ||
|
||
// Cleanup | ||
File.Delete(pathToWrite); | ||
} | ||
} | ||
} |
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,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" /> | ||
<PackageReference Include="coverlet.collector" Version="3.0.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\KotOR_IO\KotOR_IO.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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
Oops, something went wrong.