Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8605177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:45:43+00:00 2026-06-12T02:45:43+00:00

I am trying to do a unit test on some c++ code but am

  • 0

I am trying to do a unit test on some c++ code but am running into some trouble.

I have something similar to the following lines of code…

std::string s1 = obj->getName();
std::string s2 = "ExpectedName";
Assert::AreEqual(s1, s2, "Unexpected Object Name");

And I’m getting the following compiler error…

error C2665: 'Microsoft::VisualStudio::TestTools::UnitTesting::Assert::AreEqual' :
none of the 15 overloads could convert all the argument types

It seems like it should be a match with the following overload:

AreEqual<(Of <(T>)>)(T, T, String) 

Isn’t the above overload a template overload that should support any object, as long as arguments 1 and 2 are of the same type? Or am I missing something?

Is there some other way that I can accomplish this Assert?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:45:44+00:00Added an answer on June 12, 2026 at 2:45 am

    I hacked up a bit of a workaround so that integers are compared instead of strings:

    Assert::AreEqual(0, s1.compare(s2), "Unexpected Object Name");
    

    In the future, we will likely switch to native C++ unit testing, but in the meantime, this does the trick. Obviously the messaging for this isn’t very helpful

    Assert.AreEqual failed. Expected:<0>. Actual:<1>. Unexpected Trajectory Name
    

    But it’s better than nothing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to unit test some code, and I need to to replace
Following on from this question...I'm trying to unit test the following scenario: I have
Im trying to unit test a class in some Java code that I've inherited.
I'm trying to write a unit test that checks some xml parsing code. The
Basically I'm trying to start some unit tests in google test but not sure
I am currently trying to test some code I have in a web application
Im using the Prism/Composite Application Library and trying to unit test some code that
I'm trying to write some code to help unit test WCF services. These services
I'm trying to unit test some code that looks like this: def main(): parser
When trying to unit test some part of my code, I need a user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.