Skip to content

Commit

Permalink
Check if test file exists before proceeding with test.
Browse files Browse the repository at this point in the history
  • Loading branch information
claunia committed Mar 5, 2021
1 parent a2804e4 commit b5a6420
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 14 deletions.
5 changes: 0 additions & 5 deletions .idea/.idea.Aaru/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 29 additions & 2 deletions Aaru.Tests/Filesystems/FilesystemTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.Core;
Expand Down Expand Up @@ -30,7 +31,16 @@ public void Detect()
{
foreach(FileSystemTest test in Tests)
{
string testFile = test.TestFile;
string testFile = test.TestFile;

bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;

var filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(testFile);

Expand Down Expand Up @@ -97,7 +107,16 @@ public void ImageInfo()
{
foreach(FileSystemTest test in Tests)
{
string testFile = test.TestFile;
string testFile = test.TestFile;

bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;

var filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(testFile);

Expand Down Expand Up @@ -129,6 +148,14 @@ public void Info()
bool found = false;
var partition = new Partition();

bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;

var filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(testFile);

Expand Down
23 changes: 21 additions & 2 deletions Aaru.Tests/Images/BlockMediaImageTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.IO;
using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
Expand All @@ -22,7 +23,16 @@ public void Info()
{
foreach(BlockImageTestExpected test in Tests)
{
string testFile = test.TestFile;
string testFile = test.TestFile;

bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;

var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);
Expand Down Expand Up @@ -58,7 +68,16 @@ public void Hashes()
{
foreach(BlockImageTestExpected test in Tests)
{
string testFile = test.TestFile;
string testFile = test.TestFile;

bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;

var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);
Expand Down
23 changes: 21 additions & 2 deletions Aaru.Tests/Images/OpticalMediaImageTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Aaru.Checksums;
Expand Down Expand Up @@ -26,7 +27,16 @@ public void Info()
{
foreach(OpticalImageTestExpected test in Tests)
{
string testFile = test.TestFile;
string testFile = test.TestFile;

bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;

var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);
Expand Down Expand Up @@ -97,7 +107,16 @@ public void Hashes()
{
Parallel.For(0L, Tests.Length, (i, state) =>
{
string testFile = Tests[i].TestFile;
string testFile = Tests[i].TestFile;

bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
return;

var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);
Expand Down
34 changes: 31 additions & 3 deletions Aaru.Tests/Images/TapeMediaImageTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.IO;
using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
Expand All @@ -24,7 +25,16 @@ public void Tape()
{
foreach(TapeImageTestExpected test in Tests)
{
string testFile = test.TestFile;
string testFile = test.TestFile;

bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;

var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);
Expand Down Expand Up @@ -63,7 +73,16 @@ public void Info()
{
foreach(TapeImageTestExpected test in Tests)
{
string testFile = test.TestFile;
string testFile = test.TestFile;

bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;

var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);
Expand Down Expand Up @@ -99,7 +118,16 @@ public void Hashes()
{
foreach(TapeImageTestExpected test in Tests)
{
string testFile = test.TestFile;
string testFile = test.TestFile;

bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;

var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);
Expand Down
9 changes: 9 additions & 0 deletions Aaru.Tests/Partitions/PartitionSchemeTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.Core;
Expand All @@ -21,6 +22,14 @@ public void Test()
string testFile = test.TestFile;
Environment.CurrentDirectory = DataFolder;

bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;

var filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(testFile);

Expand Down

0 comments on commit b5a6420

Please sign in to comment.