dotnet: fix examples/tests

This commit is contained in:
Corentin Le Molgat
2022-09-28 18:21:45 +02:00
committed by Mizux Seiha
parent 4fc0474052
commit c4ac085833
4 changed files with 24 additions and 26 deletions

View File

@@ -12,16 +12,12 @@
// limitations under the License.
using System;
using Xunit;
using System.Collections.Generic;
using Google.OrTools.ConstraintSolver;
namespace Google.OrTools.Tests
public class Issue18
{
public class Issue18Test
{
[Fact]
public void NewSearchTest()
public static void NewSearchTest()
{
Solver solver = new Google.OrTools.ConstraintSolver.Solver("p");
@@ -52,5 +48,8 @@ public class Issue18Test
}
Console.WriteLine("Solutions: " + count);
}
static void Main()
{
NewSearchTest();
}
}
} // namespace Google.OrTools.Tests

View File

@@ -16,14 +16,11 @@ using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using Xunit;
using Google.OrTools.ConstraintSolver;
namespace Google.OrTools.Tests
{
public class Issue22Test
{
private long Solve(long num_buses_check = 0)
private static long Solve(long num_buses_check = 0)
{
ConstraintSolverParameters sPrm = Solver.DefaultSolverParameters();
sPrm.CompressTrail = 0;
@@ -72,13 +69,16 @@ public class Issue22Test
return 1;
}
[Fact]
public void InitialPropagateTest()
public static void InitialPropagateTest()
{
Console.WriteLine("Check for minimum number of buses: ");
long num_buses = Solve();
Console.WriteLine("\n... got {0} as minimal value.", num_buses);
Console.WriteLine("\nAll solutions: ", num_buses);
}
static void Main()
{
InitialPropagateTest();
}
}
} // namespace Google.OrTools.Tests

View File

@@ -20,10 +20,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System;
using Xunit;
namespace Google.OrTools.Test
{
public class Task
{
public int Id { get; private set; }
@@ -665,13 +662,15 @@ public class FactoryScheduling
}
}
public class Issue18Test
public class Issue33Test
{
[Fact]
public void FactorySchedulingTest()
public static void FactorySchedulingTest()
{
FactoryScheduling scheduling = new FactoryScheduling(new SmallSyntheticData().FetchData());
scheduling.Solve();
}
static void Main()
{
FactorySchedulingTest();
}
}
} // namespace Google.OrTools.Test

View File

@@ -226,7 +226,7 @@ endif
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" clean -c Release -v minimal
endef
DOTNET_EXAMPLES := contrib dotnet
DOTNET_EXAMPLES := contrib dotnet tests
$(foreach example,$(DOTNET_EXAMPLES),$(eval $(call dotnet-example-target,$(example))))
# Tests
@@ -390,16 +390,16 @@ check_dotnet: \
test_dotnet_linear_solver_samples \
test_dotnet_sat_samples \
.PHONY: test_dotnet_tests # Build and Run all .Net Tests (located in examples/test)
.PHONY: test_dotnet_tests # Build and Run all .Net Tests (located in examples/test and ortools/<cmp>/csharp)
test_dotnet_tests: \
rdotnet_InitTests \
rdotnet_LinearSolverTests \
rdotnet_ConstraintSolverTests \
rdotnet_RoutingSolverTests \
rdotnet_SatSolverTests \
# rdotnet_issue18 \
# rdotnet_issue22 \
# rdotnet_issue33
rdotnet_issue18 \
rdotnet_issue22 \
rdotnet_issue33
.PHONY: test_dotnet_contrib # Build and Run all .Net Examples (located in examples/contrib)
test_dotnet_contrib: \