Code Monkey home page Code Monkey logo

Comments (6)

bin3 avatar bin3 commented on August 16, 2024

The reason is that the two arguments in EXPECT_EQ have different types: one is signed integer and the other is unsigned. Maybe you can show me your code.

from balgo.

rchatsiri avatar rchatsiri commented on August 16, 2024

Data type is unsigned int by ``unsigned int value_one = 1, instead of 1 or 2 of integer type in trie_traits_test.cpp file.

unsigned int value_one = 1;
unsigned int value_two = 2;
TEST(UIntTraits, Traits) {
  EXPECT_EQ(value_one, sizeof(UIntTraits<1>::UInt));
  EXPECT_EQ(value_two, sizeof(UIntTraits<2>::UInt));
  ....
}

In additional, it's can casting type of them to unsigned int type with
EXPECT_EQ(static_cast<unsigned int>(1), sizeof(UIntTraits<1>::UInt));.
I see UnitTraits<1>::UInt from typedef typename UIntTraits<sizeof(Char)>::UInt UChar; on balgo/trie/trie_traits.h file name. It have declared unsigned integer of data type.

from balgo.

bin3 avatar bin3 commented on August 16, 2024

It's very strange that you got an "comparison between signed and unsigned integer expressions" error, because value_one and the return type of sizeof are both unsigned integer. I don't know why.
Are you sure the error line "trie_traits_test.cpp:33" is "EXPECT_EQ(value_one, sizeof(UIntTraits<1>::UInt));" ?

from balgo.

rchatsiri avatar rchatsiri commented on August 16, 2024

In trie_traits.h header file declared the data types of unsigned integer such as uintBit_t. I regress test with EXPECT_EQ(value_one, sizeof(UIntTraits<1>::UInt)); is okay in result test. It's result like declared the static casting type by EXPECT_EQ(static_cast<unsigned int>(1), sizeof(UIntTraits<1>::UInt));.

from balgo.

bin3 avatar bin3 commented on August 16, 2024

I misunderstood what you mean before, now I got it.
I have updated the code and added some more strict compiling options.
My solution is just replacing 1 with 1U.
Thank you for reminding me of that.

from balgo.

rchatsiri avatar rchatsiri commented on August 16, 2024

Okay, It should close issues by set 1U that supported data type unsigned integer.

from balgo.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.