Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
OP solved it, closing.
To those that get inexplicable precision problems: your code most likely has a conversion of double to float at some point(like the modulo operator) and loses precision.
You must throw an exception in cases like referencing an undeclared variable or an input that doesn't evaluate to an expression
Look at how the last basic test works, it expects a throw when trying to get a non-existent "y"
C++
What is the meaning of this test failure:
Expected: equal to "Error caught"
Actual: "Error not caught"
Visual Studio does have a few tricks that the Codewars editor can't match. All I meant was, if you're doing the kata on another platform, you can make your own tests (as Codewars encourages you to do anyway) and run them any way you like. You don't really need to duplicate the Codewars testing setup.
Thank you so much.
What do you mean by "Of course, you don't really need to do this just to solve the kata."? Can I also debug with the CodeWars editor environment?
You'll need the "other functions" alluded to in the description. The full class definition is below. Once you have that, you should be able to re-create the Codewars testing setup on your own platform. Of course, you don't really need to do this just to solve the kata.
Ok, I had thought my Visual Studio was not configured. For example, that I haven't updated igloo properly. But that's probably not the case.
But there is still one problem. If I use the definition of the class Image given in the text, then it does not compile.
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(129,18): error C2440: 'initializing': cannot convert from 'initializer list' to 'CentralPixels::Image'
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(136,1): message : No constructor could take the source type, or constructor overload resolution was ambiguous
On the website, however, a definition is apparently used that works. Can I have that too?
Unordered_Match
implements solution-checking for this kata via the Snowhouse assert framework used with C++ on Codewars. The criterion is that the actual and expected solutions (both vectors of unsigned integers) should contain the same elements, but not necessarily in the same order. The full source code is as follows.I use C++, Visual Studio 2022, Language Version is C++ 17.
When I copy the SampleTests of this Kata into Visual Studio 2022, the compile complains about undefined symbol Unordered_Match:
1>CentralPixels.cpp
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(101,54): error C3861: 'Unordered_Match': identifier not found
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(101,1): error C2664: 'void snowhouse::ConfigurableAssertsnowhouse::DefaultFailureHandler::That(bool)': cannot convert argument 1 from 'std::vector<unsigned int,std::allocator>' to 'bool'
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(101,40): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>A:\develop\Training\CodeWars.cpp\import\igloo\external\snowhouse\snowhouse\assert.h(109,19): message : see declaration of 'snowhouse::ConfigurableAssertsnowhouse::DefaultFailureHandler::That'
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(105,54): error C3861: 'Unordered_Match': identifier not found
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(105,1): error C2664: 'void snowhouse::ConfigurableAssertsnowhouse::DefaultFailureHandler::That(bool)': cannot convert argument 1 from 'std::vector<unsigned int,std::allocator>' to 'bool'
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(105,40): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>A:\develop\Training\CodeWars.cpp\import\igloo\external\snowhouse\snowhouse\assert.h(109,19): message : see declaration of 'snowhouse::ConfigurableAssertsnowhouse::DefaultFailureHandler::That'
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(109,54): error C3861: 'Unordered_Match': identifier not found
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(109,1): error C2664: 'void snowhouse::ConfigurableAssertsnowhouse::DefaultFailureHandler::That(bool)': cannot convert argument 1 from 'std::vector<unsigned int,std::allocator>' to 'bool'
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(109,40): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>A:\develop\Training\CodeWars.cpp\import\igloo\external\snowhouse\snowhouse\assert.h(109,19): message : see declaration of 'snowhouse::ConfigurableAssertsnowhouse::DefaultFailureHandler::That'
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(113,54): error C3861: 'Unordered_Match': identifier not found
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(113,1): error C2664: 'void snowhouse::ConfigurableAssertsnowhouse::DefaultFailureHandler::That(bool)': cannot convert argument 1 from 'std::vector<unsigned int,std::allocator>' to 'bool'
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(113,40): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>A:\develop\Training\CodeWars.cpp\import\igloo\external\snowhouse\snowhouse\assert.h(109,19): message : see declaration of 'snowhouse::ConfigurableAssertsnowhouse::DefaultFailureHandler::That'
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(117,54): error C3861: 'Unordered_Match': identifier not found
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(117,1): error C2664: 'void snowhouse::ConfigurableAssertsnowhouse::DefaultFailureHandler::That(bool)': cannot convert argument 1 from 'std::vector<unsigned int,std::allocator>' to 'bool'
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(117,40): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>A:\develop\Training\CodeWars.cpp\import\igloo\external\snowhouse\snowhouse\assert.h(109,19): message : see declaration of 'snowhouse::ConfigurableAssertsnowhouse::DefaultFailureHandler::That'
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(122,54): error C3861: 'Unordered_Match': identifier not found
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(122,1): error C2664: 'void snowhouse::ConfigurableAssertsnowhouse::DefaultFailureHandler::That(bool)': cannot convert argument 1 from 'std::vector<unsigned int,std::allocator>' to 'bool'
1>A:\develop\Training\CodeWars.cpp\CodeWars\CentralPixels.cpp(122,40): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>A:\develop\Training\CodeWars.cpp\import\igloo\external\snowhouse\snowhouse\assert.h(109,19): message : see declaration of 'snowhouse::ConfigurableAssertsnowhouse::DefaultFailureHandler::That'
1>Done building project "CodeWars.vcxproj" -- FAILED.
Try to be helpful for those who may want to help you. You will have more chances to get an answer if you present clearly your problem:
Assert::That( image.central_pixels(1), Fulfills(Unordered_Match(red_ctr)) );
Inside the tests of this kata.
Where do you see that?
What is Unordered_Match?
Loading more items...