include Sim ContractSpecs in tick unit tests
This commit is contained in:
1 parent
d691e0aeee
commit
1abf84337f
3 files changed
+19
-7
No files matched your search
Binary file not shown.
@@ -38,12 +38,11 @@ namespace bts.tests.security {
|
||||
|
||||
[Test]
|
||||
public void test_ticks() {
|
||||
foreach (var file_path in SecurityFiles.all()) {
|
||||
var ticks = read_securities(file_path).Select(s => s.ContractSpec).Distinct().ToList();
|
||||
foreach (var tick in ticks) {
|
||||
_test_ticks(tick);
|
||||
}
|
||||
}
|
||||
var from_sec_files = SecurityFiles.all().SelectMany(read_securities).Select(s => s.ContractSpec);
|
||||
var from_spec_files = ContractSpecificationFiles.all().SelectMany(read_contract_specs);
|
||||
var distinct_specs = new HashSet<ContractSpecificationImmutable>(from_sec_files.Concat(from_spec_files));
|
||||
foreach (var spec in distinct_specs)
|
||||
_test_ticks(spec);
|
||||
}
|
||||
|
||||
void _test_ticks(ContractSpecificationImmutable tick) {
|
||||
@@ -84,6 +83,9 @@ namespace bts.tests.security {
|
||||
ComparisonTests.identity_comparison(sec_list, SecurityHelper.Comparer.InstanceImmutable);
|
||||
}
|
||||
|
||||
public static IEnumerable<ContractSpecificationImmutable> read_contract_specs(string file_path) =>
|
||||
StreamHelper.ReadProtos<ContractSpecification>(ResourceHelper.LoadResource(file_path)).Select(s => new ContractSpecificationImmutable(s));
|
||||
|
||||
public static IEnumerable<SecurityImmutable> read_securities(string file_path) =>
|
||||
StreamHelper.ReadProtos<Security>(ResourceHelper.LoadResource(file_path)).Select(s => new SecurityImmutable(s));
|
||||
|
||||
@@ -97,5 +99,14 @@ namespace bts.tests.security {
|
||||
yield return NonDeterministicICEFutures;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ContractSpecificationFiles {
|
||||
public const string
|
||||
Sim = "SimContractSpecifications.contract_spec_proto";
|
||||
|
||||
public static IEnumerable<string> all() {
|
||||
yield return Sim;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
@@ -17,5 +17,6 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\KrandallOrderBookCrash.security_proto" />
|
||||
<EmbeddedResource Include="Resources\NonDeterministicICEFutures.security_proto" />
|
||||
<EmbeddedResource Include="Resources\SimContractSpecifications.contract_spec_proto" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in new issue
Block a user