473,320 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Testing IComparer Implementation

I am testing a comparer class that implements IComparer. The comparer
constructor takes as arguments a property field which can take on lets
say roughly fifteen values. It also takes two other boolean arguments.

Testing all permutations of the comparer doesn't seem practical. Are
there any suggestions for testing the comparer? Do I need to test all
permutations?

Thanks in advance for any advice.

Dec 4 '06 #1
2 1740
Depends on what your code does. If you have different execution paths based
on the values passed as an argument I would say yes.

Gabriel Lozano-Morán

<ck******@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
>I am testing a comparer class that implements IComparer. The comparer
constructor takes as arguments a property field which can take on lets
say roughly fifteen values. It also takes two other boolean arguments.

Testing all permutations of the comparer doesn't seem practical. Are
there any suggestions for testing the comparer? Do I need to test all
permutations?

Thanks in advance for any advice.

Dec 4 '06 #2
<ck******@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
>I am testing a comparer class that implements IComparer. The comparer
constructor takes as arguments a property field which can take on lets
say roughly fifteen values. It also takes two other boolean arguments.

Testing all permutations of the comparer doesn't seem practical.
Is the number of permutations 4 x 15? That doesn't sound too bad, especially
if you can make it table-driven.
Are there any suggestions for testing the comparer? Do I need to test all
permutations?
Are you a professional tester or a programmer? If the former, then yes, you
have to test all the permutations. Otherwise, my advice is to test
everything that could break.

///ark
Dec 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Tom | last post by:
Has anyone ever seen a IComparer for floats the returns magnitude. i.e. instead of returning -1, it would return -5. To let you know HOW different the two numbers are. obviously for int it is a -...
3
by: Cybertof | last post by:
Hello, Could someone please explain me the difference between the 2 interfaces IComparable and IComparer ? In which cases use one or the other ? Are they dedicated to own classes or built-in...
3
by: peorro77 | last post by:
How can i use IComparer to sort a grid of rows and lines? This is what i need: Shuffle Arraylist Field ROW Field LINE 5 2 5 3 4 2 6 ...
3
by: RJN | last post by:
Hi I have a user defined data type which implements IComparable interface and has an implementation for the CompareTo method. Public Class MyDataType Implements IComparable --Private...
10
by: INeedADip | last post by:
I am trying to use a generic (reflection) IComparer class to sort a generic list but I get the error: Unable to cast object of type 'GenericComparer' to type 'System.Collections.Generic.Icomparer...
1
by: Brett Romero | last post by:
What are the reasons to use one over the other? SortedList implements IComparer.Compare(). Why would you also want to create a SortedList class that implements IComparable.CompareTo()? I know...
1
by: =?Utf-8?B?U2FsYW1FbGlhcw==?= | last post by:
Hi, I am creating an array of performancecounter objects and wondering if it is possible to sort this array according to category Names. I tried Array.Sort(AllCountersCategories) but it is...
10
by: Tony | last post by:
Hello! I'm reading in a book and this can't be correct it says. "Objects passed to Comparer.Compare() are checked to see if they support IComparable. If they do, then that implementation is...
3
dcharnigo
by: dcharnigo | last post by:
I thought I would be tricky and force the SortedList to not sort using a custom IComparer, I used the following code, but when the list is sorting using the custom sort the accessors become unusable...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.