diff --git a/Source/ac-library-csharp/DataStructure/FenwickTree.GenericMath.cs b/Source/ac-library-csharp/DataStructure/FenwickTree.GenericMath.cs index f6f66d6..a7c18b1 100644 --- a/Source/ac-library-csharp/DataStructure/FenwickTree.GenericMath.cs +++ b/Source/ac-library-csharp/DataStructure/FenwickTree.GenericMath.cs @@ -89,7 +89,9 @@ public TValue Sum(int r) [MethodImpl(256)] public TValue Slice(int l, int len) => Sum(l, l + len); +#if EMBEDDING [SourceExpander.NotEmbeddingSource] +#endif [DebuggerDisplay("Value = {" + nameof(Value) + "}, Sum = {" + nameof(Sum) + "}")] internal readonly struct DebugItem { @@ -101,6 +103,9 @@ public DebugItem(TValue value, TValue sum) public TValue Value { get; } public TValue Sum { get; } } +#if EMBEDDING + [SourceExpander.NotEmbeddingSource] +#endif private class DebugView { private readonly FenwickTree fw; @@ -109,7 +114,6 @@ public DebugView(FenwickTree fenwickTree) fw = fenwickTree; } [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - [SourceExpander.NotEmbeddingSource] public DebugItem[] Items { get diff --git a/Source/ac-library-csharp/DataStructure/FenwickTree.cs b/Source/ac-library-csharp/DataStructure/FenwickTree.cs index d8ce74d..796c969 100644 --- a/Source/ac-library-csharp/DataStructure/FenwickTree.cs +++ b/Source/ac-library-csharp/DataStructure/FenwickTree.cs @@ -95,7 +95,9 @@ public TValue Sum(int r) [MethodImpl(256)] public TValue Slice(int l, int len) => Sum(l, l + len); +#if EMBEDDING [SourceExpander.NotEmbeddingSource] +#endif [DebuggerDisplay("Value = {" + nameof(Value) + "}, Sum = {" + nameof(Sum) + "}")] internal readonly struct DebugItem { @@ -107,6 +109,9 @@ public DebugItem(TValue value, TValue sum) public TValue Value { get; } public TValue Sum { get; } } +#if EMBEDDING + [SourceExpander.NotEmbeddingSource] +#endif private class DebugView { private readonly FenwickTree fw; @@ -115,7 +120,6 @@ public DebugView(FenwickTree fenwickTree) fw = fenwickTree; } [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - [SourceExpander.NotEmbeddingSource] public DebugItem[] Items { get diff --git a/Source/ac-library-csharp/DataStructure/LazySegtree.cs b/Source/ac-library-csharp/DataStructure/LazySegtree.cs index cb302cf..1c5440a 100644 --- a/Source/ac-library-csharp/DataStructure/LazySegtree.cs +++ b/Source/ac-library-csharp/DataStructure/LazySegtree.cs @@ -349,7 +349,9 @@ public int MinLeft(int r, Predicate g) return 0; } +#if EMBEDDING [SourceExpander.NotEmbeddingSource] +#endif [DebuggerDisplay("Value = {" + nameof(Value) + "}, Lazy = {" + nameof(Lazy) + "}", Name = "{" + nameof(Key) + ",nq}")] internal readonly struct DebugItem { @@ -369,6 +371,9 @@ public DebugItem(int l, int r, TValue value, F lazy) public TValue Value { get; } public F Lazy { get; } } +#if EMBEDDING + [SourceExpander.NotEmbeddingSource] +#endif private class DebugView { private readonly LazySegtree s; @@ -377,7 +382,6 @@ public DebugView(LazySegtree segtree) s = segtree; } [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - [SourceExpander.NotEmbeddingSource] public DebugItem[] Items { get diff --git a/Source/ac-library-csharp/DataStructure/Segtree.cs b/Source/ac-library-csharp/DataStructure/Segtree.cs index d9fde3b..1063cf0 100644 --- a/Source/ac-library-csharp/DataStructure/Segtree.cs +++ b/Source/ac-library-csharp/DataStructure/Segtree.cs @@ -252,7 +252,9 @@ public int MinLeft(int r, Predicate f) return 0; } +#if EMBEDDING [SourceExpander.NotEmbeddingSource] +#endif [DebuggerDisplay("{" + nameof(Value) + "}", Name = "{" + nameof(Key) + ",nq}")] internal readonly struct DebugItem { @@ -270,6 +272,9 @@ public DebugItem(int l, int r, TValue value) public string Key => R - L == 1 ? $"[{L}]" : $"[{L}-{R})"; public TValue Value { get; } } +#if EMBEDDING + [SourceExpander.NotEmbeddingSource] +#endif private class DebugView { private readonly Segtree s; @@ -278,7 +283,6 @@ public DebugView(Segtree segtree) s = segtree; } [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - [SourceExpander.NotEmbeddingSource] public DebugItem[] Items { get diff --git a/Source/ac-library-csharp/STL/PriorityQueue/PriorityQueueOp.cs b/Source/ac-library-csharp/STL/PriorityQueue/PriorityQueueOp.cs index 180f26e..bfbe24a 100644 --- a/Source/ac-library-csharp/STL/PriorityQueue/PriorityQueueOp.cs +++ b/Source/ac-library-csharp/STL/PriorityQueue/PriorityQueueOp.cs @@ -122,6 +122,10 @@ protected internal void UpdateDown(int i) [EditorBrowsable(Never)] public ReadOnlySpan Unorderd() => data.AsSpan(0, Count); + +#if EMBEDDING + [SourceExpander.NotEmbeddingSource] +#endif private class DebugView { private readonly PriorityQueueOp pq; diff --git a/Source/ac-library-csharp/STL/PriorityQueue/PriorityQueueOp`2.cs b/Source/ac-library-csharp/STL/PriorityQueue/PriorityQueueOp`2.cs index 00d2a73..12bf2c9 100644 --- a/Source/ac-library-csharp/STL/PriorityQueue/PriorityQueueOp`2.cs +++ b/Source/ac-library-csharp/STL/PriorityQueue/PriorityQueueOp`2.cs @@ -152,6 +152,10 @@ protected internal void UpdateDown(int i) public ReadOnlySpan UnorderdKeys() => keys.AsSpan(0, Count); [EditorBrowsable(Never)] public ReadOnlySpan UnorderdValues() => values.AsSpan(0, Count); + +#if EMBEDDING + [SourceExpander.NotEmbeddingSource] +#endif private class DebugView { private readonly PriorityQueueOp pq; diff --git a/Test/ac-library-csharp.Test/SourceExpanderTest.cs b/Test/ac-library-csharp.Test/SourceExpanderTest.cs index 5c4ec8e..ff2bc16 100644 --- a/Test/ac-library-csharp.Test/SourceExpanderTest.cs +++ b/Test/ac-library-csharp.Test/SourceExpanderTest.cs @@ -107,57 +107,32 @@ public async Task EmbeddedNamespaces() "AtCoder.Operators"); } - [EmbeddingFact] public async Task RemoveContract() { var embedded = await EmbeddedData.LoadFromAssembly(typeof(Segtree<,>)); - var codes = embedded.SourceFiles.Select(s => s.CodeBody); - codes.Should().NotContain(code => code.Contains("Contract.Assert")); + var code = string.Join(' ', embedded.SourceFiles.Select(s => s.CodeBody)); + code.Should().NotContain("Contract.Assert"); } [EmbeddingFact] - public async Task SegtreeDebugView() + public async Task RemoveDebugView() { var embedded = await EmbeddedData.LoadFromAssembly(typeof(Segtree<,>)); - var source = embedded.SourceFiles.Single(s => s.FileName.Split('\\', '/').Last() == "Segtree.cs"); - source.CodeBody.Should() - .EndWith("private class DebugView{private readonly Segtrees;public DebugView(Segtreesegtree){s=segtree;}}}}") - .And - .NotContain("DebugItem"); - } - - [EmbeddingFact] - public async Task LazySegtreeDebugView() - { - var embedded = await EmbeddedData.LoadFromAssembly(typeof(Segtree<,>)); - var source = embedded.SourceFiles.Single(s => s.FileName.Split('\\', '/').Last() == "LazySegtree.cs"); - source.CodeBody.Should() - .EndWith("private class DebugView{private readonly LazySegtrees;public DebugView(LazySegtreesegtree){s=segtree;}}}}") - .And - .NotContain("DebugItem"); + var code = string.Join(' ', embedded.SourceFiles.Select(s => s.CodeBody)); + code.Should().Contain("CollectionDebugView"); + code.Replace("CollectionDebugView", "CoDe").Should().NotContain("Debug"); } [EmbeddingGenericMathFact] - public async Task FenwickTreeGenericMathDebugView() + public async Task FenwickTreeGenericMath() { var embedded = await EmbeddedData.LoadFromAssembly(typeof(Segtree<,>)); var source = embedded.SourceFiles.Single(s => s.FileName.Split('\\', '/').Last() == "FenwickTree.GenericMath.cs"); source.CodeBody.Should() - .EndWith("private class DebugView{private readonly FenwickTreefw;public DebugView(FenwickTreefenwickTree){fw=fenwickTree;}}}}") - .And - .NotContain("DebugItem"); - } - - [EmbeddingFact] - public async Task FenwickTreeDebugView() - { - var embedded = await EmbeddedData.LoadFromAssembly(typeof(Segtree<,>)); - var source = embedded.SourceFiles.Single(s => s.FileName.Split('\\', '/').Last() == "FenwickTree.cs"); - source.CodeBody.Should() - .EndWith("private class DebugView{private readonly FenwickTreefw;public DebugView(FenwickTreefenwickTree){fw=fenwickTree;}}}}") + .Contain("FenwickTree") .And - .NotContain("DebugItem"); + .NotContain("Debug"); } #if DEBUG