Skip to content

Conversation

Ronitsabhaya75
Copy link

Fix TestDateDiff, TestAddOob, TestAddition, and TestSubtraction unit tests in DateCalculatorUnitTests.cpp by updating API calls to match current interfaces and adding proper verification steps. These tests were previously disabled with TODO comments referencing MSFT 10331900.

@Ronitsabhaya75
Copy link
Author

@microsoft-github-policy-service agree

@tian-lt
Copy link
Contributor

tian-lt commented Jul 2, 2025

Hi @hanzhang54, do you know what MSFT 10331900 is? Could you help verify if our pipelines can pass once those test code is enabled? Thanks.

@tian-lt tian-lt requested a review from hanzhang54 July 2, 2025 04:56
@Ronitsabhaya75
Copy link
Author

@tian-lt Can you please review this and suggest any changes

@Kve-sudo
Copy link

Kve-sudo commented Jul 4, 2025

@

@tian-lt
Copy link
Contributor

tian-lt commented Jul 4, 2025

@Ronitsabhaya75 There seems to be some build errors about the changes in this PR. Could you please take a look?

##[error]src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,50): Error C2660: 'CalculatorApp::ViewModel::Common::DateCalculation::DateCalculationEngine::TryGetDateDifference': function does not take 4 arguments
4>D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,50): error C2660: 'CalculatorApp::ViewModel::Common::DateCalculation::DateCalculationEngine::TryGetDateDifference': function does not take 4 arguments [D:\a_work\1\s\src\CalculatorUnitTests\CalculatorUnitTests.vcxproj]
(compiling source file '/DateCalculatorUnitTests.cpp')
D:\a_work\1\s\src\CalcViewModel\Common\DateCalculator.h(55,39):
see declaration of 'CalculatorApp::ViewModel::Common::DateCalculation::DateCalculationEngine::TryGetDateDifference'
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,50):
while trying to match the argument list '(Windows::Foundation::DateTime, Windows::Foundation::DateTime, CalculatorApp::ViewModel::Common::DateCalculation::DateUnit, CalculatorApp::ViewModel::Common::DateCalculation::DateDifference *)'

##[error]src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,30): Error C2440: 'initializing': cannot convert from 'Platform::IBoxCalculatorApp::ViewModel::Common::DateCalculation::DateDifference ^' to 'bool'
4>D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,30): error C2440: 'initializing': cannot convert from 'Platform::IBoxCalculatorApp::ViewModel::Common::DateCalculation::DateDifference ^' to 'bool' [D:\a_work\1\s\src\CalculatorUnitTests\CalculatorUnitTests.vcxproj]
(compiling source file '/DateCalculatorUnitTests.cpp')
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,30):
No user-defined-conversion operator available, or
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,30):
There is no context in which this conversion is possible

##[error]src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(376,52): Error C2664: 'SYSTEMTIME DateCalculationUnitTests::DateUtils::DateTimeToSystemTime(Windows::Foundation::DateTime)': cannot convert argument 1 from 'Platform::IBoxWindows::Foundation::DateTime' to 'Windows::Foundation::DateTime'
4>D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(376,52): error C2664: 'SYSTEMTIME DateCalculationUnitTests::DateUtils::DateTimeToSystemTime(Windows::Foundation::DateTime)': cannot convert argument 1 from 'Platform::IBoxWindows::Foundation::DateTime' to 'Windows::Foundation::DateTime' [D:\a_work\1\s\src\CalculatorUnitTests\CalculatorUnitTests.vcxproj]
(compiling source file '/DateCalculatorUnitTests.cpp')
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(376,73):
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
D:\a_work\1\s\src\CalculatorUnitTests\DateUtils.h(28,27):
see declaration of 'DateCalculationUnitTests::DateUtils::DateTimeToSystemTime'
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(376,52):
while trying to match the argument list '(Platform::IBoxWindows::Foundation::DateTime)'

##[error]src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(403,52): Error C2664: 'SYSTEMTIME DateCalculationUnitTests::DateUtils::DateTimeToSystemTime(Windows::Foundation::DateTime)': cannot convert argument 1 from 'Platform::IBoxWindows::Foundation::DateTime' to 'Windows::Foundation::DateTime'
4>D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(403,52): error C2664: 'SYSTEMTIME DateCalculationUnitTests::DateUtils::DateTimeToSystemTime(Windows::Foundation::DateTime)': cannot convert argument 1 from 'Platform::IBoxWindows::Foundation::DateTime' to 'Windows::Foundation::DateTime' [D:\a_work\1\s\src\CalculatorUnitTests\CalculatorUnitTests.vcxproj]
(compiling source file '/DateCalculatorUnitTests.cpp')
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(403,73):
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
D:\a_work\1\s\src\CalculatorUnitTests\DateUtils.h(28,27):
see declaration of 'DateCalculationUnitTests::DateUtils::DateTimeToSystemTime'
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(403,52):
while trying to match the argument list '(Platform::IBoxWindows::Foundation::DateTime)'

@Ronitsabhaya75
Copy link
Author

@Ronitsabhaya75 There seems to be some build errors about the changes in this PR. Could you please take a look?

##[error]src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,50): Error C2660: 'CalculatorApp::ViewModel::Common::DateCalculation::DateCalculationEngine::TryGetDateDifference': function does not take 4 arguments
4>D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,50): error C2660: 'CalculatorApp::ViewModel::Common::DateCalculation::DateCalculationEngine::TryGetDateDifference': function does not take 4 arguments [D:\a_work\1\s\src\CalculatorUnitTests\CalculatorUnitTests.vcxproj]
(compiling source file '/DateCalculatorUnitTests.cpp')
D:\a_work\1\s\src\CalcViewModel\Common\DateCalculator.h(55,39):
see declaration of 'CalculatorApp::ViewModel::Common::DateCalculation::DateCalculationEngine::TryGetDateDifference'
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,50):
while trying to match the argument list '(Windows::Foundation::DateTime, Windows::Foundation::DateTime, CalculatorApp::ViewModel::Common::DateCalculation::DateUnit, CalculatorApp::ViewModel::Common::DateCalculation::DateDifference *)'
##[error]src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,30): Error C2440: 'initializing': cannot convert from 'Platform::IBoxCalculatorApp::ViewModel::Common::DateCalculation::DateDifference ^' to 'bool'
4>D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,30): error C2440: 'initializing': cannot convert from 'Platform::IBoxCalculatorApp::ViewModel::Common::DateCalculation::DateDifference ^' to 'bool' [D:\a_work\1\s\src\CalculatorUnitTests\CalculatorUnitTests.vcxproj]
(compiling source file '/DateCalculatorUnitTests.cpp')
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,30):
No user-defined-conversion operator available, or
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(312,30):
There is no context in which this conversion is possible
##[error]src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(376,52): Error C2664: 'SYSTEMTIME DateCalculationUnitTests::DateUtils::DateTimeToSystemTime(Windows::Foundation::DateTime)': cannot convert argument 1 from 'Platform::IBoxWindows::Foundation::DateTime' to 'Windows::Foundation::DateTime'
4>D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(376,52): error C2664: 'SYSTEMTIME DateCalculationUnitTests::DateUtils::DateTimeToSystemTime(Windows::Foundation::DateTime)': cannot convert argument 1 from 'Platform::IBoxWindows::Foundation::DateTime' to 'Windows::Foundation::DateTime' [D:\a_work\1\s\src\CalculatorUnitTests\CalculatorUnitTests.vcxproj]
(compiling source file '/DateCalculatorUnitTests.cpp')
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(376,73):
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
D:\a_work\1\s\src\CalculatorUnitTests\DateUtils.h(28,27):
see declaration of 'DateCalculationUnitTests::DateUtils::DateTimeToSystemTime'
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(376,52):
while trying to match the argument list '(Platform::IBoxWindows::Foundation::DateTime)'
##[error]src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(403,52): Error C2664: 'SYSTEMTIME DateCalculationUnitTests::DateUtils::DateTimeToSystemTime(Windows::Foundation::DateTime)': cannot convert argument 1 from 'Platform::IBoxWindows::Foundation::DateTime' to 'Windows::Foundation::DateTime'
4>D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(403,52): error C2664: 'SYSTEMTIME DateCalculationUnitTests::DateUtils::DateTimeToSystemTime(Windows::Foundation::DateTime)': cannot convert argument 1 from 'Platform::IBoxWindows::Foundation::DateTime' to 'Windows::Foundation::DateTime' [D:\a_work\1\s\src\CalculatorUnitTests\CalculatorUnitTests.vcxproj]
(compiling source file '/DateCalculatorUnitTests.cpp')
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(403,73):
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
D:\a_work\1\s\src\CalculatorUnitTests\DateUtils.h(28,27):
see declaration of 'DateCalculationUnitTests::DateUtils::DateTimeToSystemTime'
D:\a_work\1\s\src\CalculatorUnitTests\DateCalculatorUnitTests.cpp(403,52):
while trying to match the argument list '(Platform::IBoxWindows::Foundation::DateTime)'

yes I can have look

@tian-lt
Copy link
Contributor

tian-lt commented Jul 4, 2025

And, something might be wrong about the checks for this PR. please allow me to close and reopen this PR so that we can trigger the GitHub Action for the PR. Thanks.

@tian-lt tian-lt closed this Jul 4, 2025
@tian-lt tian-lt reopened this Jul 4, 2025
@Ronitsabhaya75
Copy link
Author

@tian-lt can you please review this changes. sorry for pushing this late i was actually busy with my intern program.

@tian-lt
Copy link
Contributor

tian-lt commented Aug 12, 2025

@Ronitsabhaya75 thank you for pushing a fix.
Looks like we have a run time failure in UT for now. Could you help take a look?

Failed TestDateDiff [< 1 ms]
Error Message:
Assert failed

@Ronitsabhaya75
Copy link
Author

@Ronitsabhaya75 thank you for pushing a fix. Looks like we have a run time failure in UT for now. Could you help take a look?

Failed TestDateDiff [< 1 ms]
Error Message:
Assert failed

let me see that and fix it

@Ronitsabhaya75
Copy link
Author

@tian-lt i think this should fix now can you run it through all tests

@Ronitsabhaya75
Copy link
Author

@tian-lt is it possible to run the test and see if this is failing or not.

@tian-lt
Copy link
Contributor

tian-lt commented Aug 13, 2025

@tian-lt is it possible to run the test and see if this is failing or not.

sure. I’ve triggered a run for it. BTW, the Unit tests are able to run on your local machine. It will give you more information about the test failure.

@Ronitsabhaya75
Copy link
Author

@tian-lt is it possible to run the test and see if this is failing or not.

sure. I’ve triggered a run for it. BTW, the Unit tests are able to run on your local machine. It will give you more information about the test failure.

I tested them they were working correctly i honestly dont know why is this causing issue here

@Ronitsabhaya75
Copy link
Author

@tian-lt can you give me access to trigger those test manually for this pr for checking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants