public async Task LanguageVersion() { var embedded = await EmbeddedData.LoadFromAssembly(typeof(Global)); embedded.AssemblyMetadatas .Should().ContainKey("SourceExpander.EmbeddedLanguageVersion") .WhoseValue.Should().Be("8.0"); }
public async Task RemoveContract() { var embedded = await EmbeddedData.LoadFromAssembly(typeof(Mod1000000007)); var codes = embedded.SourceFiles.Select(s => s.CodeBody); codes.Should().NotContain(code => code.Contains("Contract.Assert")); }
public async Task EmbeddedNamespaces() { var embedded = await EmbeddedData.LoadFromAssembly(typeof(Mod1000000007)); embedded.AssemblyMetadatas.Should().ContainKey("SourceExpander.EmbeddedNamespaces"); embedded.EmbeddedNamespaces.Should() .Equal( "AtCoder", "AtCoder.Extension", "AtCoder.Internal", "AtCoder.Operators"); }
private static ValueTask <EmbeddedData> GetEmbeddedDataAsync(string assemblyPath) { var alc = new AssemblyLoadContext("GetEmbeddedData", true); try { return(EmbeddedData.LoadFromAssembly(alc.LoadFromAssemblyPath(Path.GetFullPath(assemblyPath)))); } finally { alc.Unload(); } }
public async Task EmbeddedNamespaces() { var embedded = await EmbeddedData.LoadFromAssembly(typeof(Global)); embedded.AssemblyMetadatas.Should().ContainKey("SourceExpander.EmbeddedNamespaces"); embedded.EmbeddedNamespaces .Should() .Equal( "Kzrnm.Competitive", "Kzrnm.Competitive.DataStructure", "Kzrnm.Competitive.DebugUtil", "Kzrnm.Competitive.LinqInternals", "Kzrnm.Competitive.SetInternals"); }
public async Task LanguageVersion() { const string VERSION = #if NETCOREAPP3_0 "7.3" #else "8.0" #endif ; var embedded = await EmbeddedData.LoadFromAssembly(typeof(Mod1000000007)); embedded.AssemblyMetadatas .Should().ContainKey("SourceExpander.EmbeddedLanguageVersion") .WhoseValue.Should().Be(VERSION); }
public async Task Symbol() { var embedded = await EmbeddedData.LoadFromAssembly(typeof(Mod1000000007)); embedded.AssemblyMetadatas.Should().ContainKey("SourceExpander.EmbeddedSourceCode.GZipBase32768"); embedded.SourceFiles.Select(s => s.FileName) .Should() .HaveCountGreaterThan(2) .And .OnlyContain(name => name.StartsWith("AtCoderLibrary>")); embedded.SourceFiles.SelectMany(s => s.Usings) .Contains("using System.Runtime.Intrinsics.X86;") .Should() .Be(useIntrinsics); }
public async Task EmbeddedSource() { var embedded = await EmbeddedData.LoadFromAssembly(typeof(Mod1000000007)); embedded.AssemblyMetadatas.Should().ContainKey("SourceExpander.EmbeddedSourceCode.GZipBase32768"); embedded.SourceFiles.Select(s => s.FileName) .Should() .HaveCountGreaterThan(2) .And .OnlyContain(name => name.StartsWith("AtCoderLibrary>")); embedded.SourceFiles.SelectMany(s => s.TypeNames) .Should() .Contain( "AtCoder.Operators.IArithmeticOperator<T>", "AtCoder.Segtree<TValue, TOp>"); }
public async Task EmbeddedSource() { var embedded = await EmbeddedData.LoadFromAssembly(typeof(Global)); embedded.AssemblyMetadatas.Should().ContainKey("SourceExpander.EmbeddedSourceCode.GZipBase32768"); embedded.SourceFiles.Select(s => s.FileName) .Should() .HaveCountGreaterThan(2) .And .OnlyContain(name => name.StartsWith("Competitive.Library>")); embedded.SourceFiles.SelectMany(s => s.TypeNames) .Should() .Contain( "Kzrnm.Competitive.Global", "Kzrnm.Competitive.FenwickTreeExtension"); }
public async Task Embedded() { var embedded = await EmbeddedData.LoadFromAssembly(typeof(Expander)); embedded.EmbeddedLanguageVersion.Should().Be(LanguageVersion.CSharp4.ToDisplayString()); embedded.SourceFiles.Should().ContainSingle() .Which .Should() .BeEquivalentTo(new SourceFileInfo( "SourceExpander>Expander.cs", ImmutableArray.Create("SourceExpander.Expander"), ImmutableArray.Create("using System.Diagnostics;"), ImmutableArray <string> .Empty, "namespace SourceExpander{public class Expander{[Conditional(\"EXP\")]" + "public static void Expand(string inputFilePath=null,string outputFilePath=null,bool ignoreAnyError=true){}" + "public static string ExpandString(string inputFilePath=null,bool ignoreAnyError=true){return \"\";}}}")); }