DotNet Reference

.Net Reference

InitTests.cs
Go to the documentation of this file.
1 // Copyright 2010-2022 Google LLC
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 using System;
15 using Xunit;
16 using Google.OrTools.Init;
17 using static Google.OrTools.Init.operations_research_init;
18 
19 namespace Google.OrTools.Tests
20 {
21 public class InitTest
22 {
23  [Fact]
24  public void CheckLogging()
25  {
26  Init.CppBridge.InitLogging("init");
27  Init.CppBridge.ShutdownLogging();
28  }
29 
30  [Fact]
31  public void CheckFlags()
32  {
33  Init.CppFlags cpp_flags = new Init.CppFlags();
34  cpp_flags.stderrthreshold = 0;
35  cpp_flags.log_prefix = true;
36  cpp_flags.cp_model_dump_prefix = "init";
37  cpp_flags.cp_model_dump_models = true;
38  cpp_flags.cp_model_dump_lns = true;
39  cpp_flags.cp_model_dump_response = true;
40  Init.CppBridge.SetFlags(cpp_flags);
41  }
42 
43  [Fact]
44  public void CheckOrToolsVersion()
45  {
46  int major = OrToolsVersion.MajorNumber();
47  int minor = OrToolsVersion.MinorNumber();
48  int patch = OrToolsVersion.PatchNumber();
49  string version = OrToolsVersion.VersionString();
50  Assert.Equal($"{major}.{minor}.{patch}", version);
51  }
52 }
53 } // namespace Google.OrTools.Tests