Mercurial > repos > IBBoard
changeset 102:797aa3d2caa4
Re #48: Collection equality
* Add initial code for testing list equality
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 26 Apr 2011 14:16:27 +0000 |
parents | 566a7af8f149 |
children | 8022850f7fd7 |
files | Collections/Collections.cs IBBoard.csproj |
diffstat | 2 files changed, 46 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Collections/Collections.cs Tue Apr 26 14:16:27 2011 +0000 @@ -0,0 +1,44 @@ +// This file (Collections.cs) is a part of the IBBoard project and is copyright 2011 IBBoard +// +// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU LGPL, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. +using System; +using System.Collections.Generic; + +namespace IBBoard.Collections +{ + public class Collections + { + private Collections() + { + } + + public static bool AreEqual (IList<int> list1, IList<int> list2) + { + bool equal = true; + + if (!EqualityChecker.AreEqual(list1, list2)) + { + if (list1.Count != list2.Count) + { + equal = false; + } + else + { + int length = list1.Count; + + for (int i = 0; i < length; i++) + { + if (!EqualityChecker.AreEqual(list1[i], list2[i])) + { + equal = false; + break; + } + } + } + } + + return equal; + } + } +} +
--- a/IBBoard.csproj Sun Apr 03 13:30:07 2011 +0000 +++ b/IBBoard.csproj Tue Apr 26 14:16:27 2011 +0000 @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <ProjectType>Local</ProjectType> @@ -158,6 +158,7 @@ <Compile Include="Lang\ModifiableTranslationSet.cs" /> <Compile Include="EqualityChecker.cs" /> <Compile Include="IO\StreamUtil.cs" /> + <Compile Include="Collections\Collections.cs" /> </ItemGroup> <ItemGroup> <BootstrapperPackage Include="Microsoft.Net.Client.3.5">