Skip to content

Commit 9fe03e3

Browse files
committed
Add List<T> and related classes
- Add unit tests. - Bump native assembly version. - Update nuspec
1 parent eff0831 commit 9fe03e3

27 files changed

Lines changed: 2130 additions & 56 deletions
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
//using nanoFramework.TestFramework;
2+
//using System;
3+
//using System.Collections;
4+
5+
//namespace GenericCollections
6+
//{
7+
// public class CollectionTestBase
8+
// {
9+
// protected static readonly int[] s_intArray = new[] { -4, 5, -2, 3, 1, 2, -1, -3, 0, 4, -5, 3, 3 };
10+
// protected static readonly int[] s_excludedFromIntArray = new int[] { 100, -34, 42, int.MaxValue, int.MinValue };
11+
12+
// [Flags]
13+
// protected enum IListApi
14+
// {
15+
// None = 0,
16+
// IndexerGet = 0x1,
17+
// IndexerSet = 0x2,
18+
// Count = 0x4,
19+
// IsReadOnly = 0x8,
20+
// Clear = 0x10,
21+
// Contains = 0x20,
22+
// CopyTo = 0x40,
23+
// GetEnumeratorGeneric = 0x80,
24+
// IndexOf = 0x100,
25+
// Insert = 0x200,
26+
// RemoveAt = 0x400,
27+
// GetEnumerator = 0x800,
28+
// End
29+
// }
30+
31+
// protected class CallTrackingIList<T> : IList<T>
32+
// {
33+
// private IListApi _expectedApiCalls;
34+
// private IListApi _calledMembers;
35+
36+
// public CallTrackingIList(IListApi expectedApiCalls)
37+
// {
38+
// _expectedApiCalls = expectedApiCalls;
39+
// }
40+
41+
// public void AssertAllMembersCalled()
42+
// {
43+
// if (_expectedApiCalls != _calledMembers)
44+
// {
45+
// for (IListApi i = (IListApi)1; i < IListApi.End; i = (IListApi)((int)i << 1))
46+
// {
47+
// Assert.Equal(_expectedApiCalls & i, _calledMembers & i);
48+
// }
49+
// }
50+
// }
51+
52+
// public T this[int index]
53+
// {
54+
// get
55+
// {
56+
// _calledMembers |= IListApi.IndexerGet;
57+
// return default(T);
58+
// }
59+
// set
60+
// {
61+
// _calledMembers |= IListApi.IndexerSet;
62+
// }
63+
// }
64+
65+
// public int Count
66+
// {
67+
// get
68+
// {
69+
// _calledMembers |= IListApi.Count;
70+
// return 1;
71+
// }
72+
// }
73+
74+
// public bool IsReadOnly
75+
// {
76+
// get
77+
// {
78+
// _calledMembers |= IListApi.IsReadOnly;
79+
// return false;
80+
// }
81+
// }
82+
83+
// public void Add(T item)
84+
// {
85+
// throw new NotImplementedException();
86+
// }
87+
88+
// public void Clear()
89+
// {
90+
// _calledMembers |= IListApi.Clear;
91+
// }
92+
93+
// public bool Contains(T item)
94+
// {
95+
// _calledMembers |= IListApi.Contains;
96+
// return false;
97+
// }
98+
99+
// public void CopyTo(T[] array, int arrayIndex)
100+
// {
101+
// _calledMembers |= IListApi.CopyTo;
102+
// }
103+
104+
// public IEnumerator<T> GetEnumerator()
105+
// {
106+
// _calledMembers |= IListApi.GetEnumeratorGeneric;
107+
// return null;
108+
// }
109+
110+
// public int IndexOf(T item)
111+
// {
112+
// _calledMembers |= IListApi.IndexOf;
113+
// return -1;
114+
// }
115+
116+
// public void Insert(int index, T item)
117+
// {
118+
// _calledMembers |= IListApi.Insert;
119+
// }
120+
121+
// public bool Remove(T item)
122+
// {
123+
// throw new NotImplementedException();
124+
// }
125+
126+
// public void RemoveAt(int index)
127+
// {
128+
// _calledMembers |= IListApi.RemoveAt;
129+
// }
130+
131+
// IEnumerator IEnumerable.GetEnumerator()
132+
// {
133+
// _calledMembers |= IListApi.GetEnumerator;
134+
// return null;
135+
// }
136+
// }
137+
// }
138+
//}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Label="Globals">
4+
<NanoFrameworkProjectSystemPath>$(MSBuildExtensionsPath)\nanoFramework\v1.0\</NanoFrameworkProjectSystemPath>
5+
</PropertyGroup>
6+
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props')" />
7+
<ItemGroup>
8+
<ProjectCapability Include="TestContainer" />
9+
</ItemGroup>
10+
<PropertyGroup>
11+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
12+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
13+
<ProjectTypeGuids>{11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<ProjectGuid>2b275f71-e555-46bf-b1fe-c33d4cb06545</ProjectGuid>
15+
<OutputType>Library</OutputType>
16+
<AppDesignerFolder>Properties</AppDesignerFolder>
17+
<FileAlignment>512</FileAlignment>
18+
<RootNamespace>GenericCollections</RootNamespace>
19+
<AssemblyName>NFUnitTest</AssemblyName>
20+
<IsCodedUITest>False</IsCodedUITest>
21+
<IsTestProject>true</IsTestProject>
22+
<TestProjectType>UnitTest</TestProjectType>
23+
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
24+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
25+
<RestoreLockedMode Condition="'$(TF_BUILD)' == 'True' or '$(ContinuousIntegrationBuild)' == 'True'">true</RestoreLockedMode>
26+
</PropertyGroup>
27+
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" />
28+
<ItemGroup>
29+
<Compile Include="CollectionTestBase.cs" />
30+
<Compile Include="ListTests.cs" />
31+
<Compile Include="Properties\AssemblyInfo.cs" />
32+
</ItemGroup>
33+
<ItemGroup>
34+
<None Include="packages.config" />
35+
</ItemGroup>
36+
<ItemGroup>
37+
<ProjectReference Include="..\..\nanoFramework.System.Collections\nanoFramework.System.Collections.nfproj" />
38+
</ItemGroup>
39+
<ItemGroup>
40+
<Reference Include="mscorlib">
41+
<HintPath>..\..\packages\nanoFramework.CoreLibrary.2.0.0-preview.20\lib\netnano1.0\mscorlib.dll</HintPath>
42+
</Reference>
43+
<Reference Include="nanoFramework.TestFramework">
44+
<HintPath>..\..\packages\nanoFramework.TestFramework.4.0.0-preview.44\lib\nanoFramework.TestFramework.dll</HintPath>
45+
</Reference>
46+
<Reference Include="nanoFramework.UnitTestLauncher">
47+
<HintPath>..\..\packages\nanoFramework.TestFramework.4.0.0-preview.44\lib\nanoFramework.UnitTestLauncher.exe</HintPath>
48+
</Reference>
49+
</ItemGroup>
50+
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets')" />
51+
</Project>

0 commit comments

Comments
 (0)