C++ Test Suite

Hi,

I just finished an initial implementation of semantic checks for reinterpret_cast, but I have the nagging feeling that I've got a lot of corner cases wrong.
Now, since I wrote the code and since I'm note sure about these corner cases, I feel like I'm the wrong person to write test cases for the functionality.

Does anyone know of a proper set of test cases for C++ that we can use? I looked at GCC's test suite, but it doesn't have many test cases for this.

Failing that, is anyone willing to sit down and write a set of test cases for reinterpret_cast?

Sebastian

Hi Sebastian,

I just finished an initial implementation of semantic checks for
reinterpret_cast,

Great!

but I have the nagging feeling that I've got a lot of
corner cases wrong.
Now, since I wrote the code and since I'm note sure about these corner
cases, I feel like I'm the wrong person to write test cases for the
functionality.

Did you try all of the reinterpret_cast examples from the standard?
Those are good for a quick sanity check.

Does anyone know of a proper set of test cases for C++ that we can use?
I looked at GCC's test suite, but it doesn't have many test cases for this.

There really aren't any good, free C++ test suites out there. As
you've noted, GCC's test suite is sparse, and the only more
comprehensive test suites are commercial (and expensive).The best test
suites are large C++ applications, but of course we're not to the
point where we can handle those, yet.

Failing that, is anyone willing to sit down and write a set of test
cases for reinterpret_cast?

Oddly enough, I was thinking about this kind of thing today, and I
have a similar distrust of my tests for the basic overloading patch I
sent a while back. It would be a great practice for building out our
test suite if we wrote tests for those features that we didn't
implement, because we're more likely to catch bugs if we don't know
how the implementation works.

So, if someone has some time, I hope they step up and write some tests
for reinterpret_cast. I'll volunteer to write (more) tests for your
const_cast patch (and then review it) within the next week.

  - Doug

Doug Gregor wrote:

Hi Sebastian,

Now, since I wrote the code and since I'm note sure about these corner
cases, I feel like I'm the wrong person to write test cases for the
functionality.
    
Did you try all of the reinterpret_cast examples from the standard?
Those are good for a quick sanity check.
  

I searched the standard for reinterpret_cast and can't find any examples. Am I overlooking something?

Sebastian

That's horrifying :slight_smile:

But, no, you didn't miss anything; the C++0x working draft doesn't
seem to have any examples of reinterpret_cast either. We'll just have
to write our own tests.

  - Doug