-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathSources.cs
More file actions
147 lines (125 loc) · 4.2 KB
/
Sources.cs
File metadata and controls
147 lines (125 loc) · 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
using System;
namespace Sources;
public class NewSources
{
// Defined as source in the extensions file next to the test.
// neutral=Sources;NewSources;Source1;();summary;df-generated
public static string Source1() => throw null;
// Defined as source in the extensions file next to the test.
// neutral=Sources;NewSources;Source2;();summary;df-generated
public static string Source2() => throw null;
// New source
// source=Sources;NewSources;false;WrapConsoleReadLine;();;ReturnValue;stdin;df-generated
// neutral=Sources;NewSources;WrapConsoleReadLine;();summary;df-generated
public string? WrapConsoleReadLine()
{
return Console.ReadLine();
}
// New source
// source=Sources;NewSources;false;WrapConsoleReadLineAndProcees;(System.String);;ReturnValue;stdin;df-generated
// neutral=Sources;NewSources;WrapConsoleReadLineAndProcees;(System.String);summary;df-generated
public string WrapConsoleReadLineAndProcees(string prompt)
{
var s = Console.ReadLine();
return string.IsNullOrEmpty(s) ? "" : s.ToUpper();
}
// NOT new source as method is private
private string? PrivateWrapConsoleReadLine()
{
return Console.ReadLine();
}
// New source
// source=Sources;NewSources;false;WrapConsoleReadKey;();;ReturnValue;stdin;df-generated
// neutral=Sources;NewSources;WrapConsoleReadKey;();summary;df-generated
public ConsoleKeyInfo WrapConsoleReadKey()
{
return Console.ReadKey();
}
// Not a new source because a simple type is used in an intermediate step
// neutral=Sources;NewSources;WrapConsoleReadLineGetBool;();summary;df-generated
public bool WrapConsoleReadLineGetBool()
{
var s = Console.ReadLine();
return s == "hello";
}
public abstract class ValueReader
{
// neutral=Sources;NewSources+ValueReader;GetValue;();summary;df-generated
public abstract string GetValue();
}
public class MyConsoleReader : ValueReader
{
// neutral=Sources;NewSources+MyConsoleReader;GetValue;();summary;df-generated
public override string GetValue()
{
return Console.ReadLine();
}
}
public class MyOtherReader : ValueReader
{
// neutral=Sources;NewSources+MyOtherReader;GetValue;();summary;df-generated
public override string GetValue()
{
return "";
}
}
public class MyContainer<T> where T : ValueReader
{
public T Value { get; set; }
// neutral=Sources;NewSources+MyContainer<T>;Read;();summary;df-generated
public string Read()
{
return Value.GetValue();
}
}
// Not a new source as this callable has been manually modelled
// as source neutral.
// neutral=Sources;NewSources;ManualNeutralSource;();summary;df-generated
public string ManualNeutralSource()
{
return Console.ReadLine();
}
// Not a new source as this callable already has a manual source.
// neutral=Sources;NewSources;ManualSourceAlreadyDefined;();summary;df-generated
public string ManualSourceAlreadyDefined()
{
return Console.ReadLine();
}
public abstract class DataReader
{
// neutral=Sources;NewSources+DataReader;Read;();summary;df-generated
public abstract string Read();
}
public class DataReaderKind1 : DataReader
{
// neutral=Sources;NewSources+DataReaderKind1;Read;();summary;df-generated
public override string Read()
{
return Source1();
}
}
public sealed class DataReaderKind2 : DataReader
{
// neutral=Sources;NewSources+DataReaderKind2;Read;();summary;df-generated
public override string Read()
{
return Source2();
}
}
public class C1
{
// neutral=Sources;NewSources+C1;ToString;();summary;df-generated
public override string ToString()
{
return Source1();
}
}
public sealed class C2
{
// neutral=Sources;NewSources+C2;ToString;();summary;df-generated
public override string ToString()
{
return Source1();
}
}
}