示例#1
0
TEST(Integer, to_string_negative) {
    // Setup
    Integer* x = new Integer(-5);

    // Assertion
    EXPECT_TRUE(x->toString() == "-5");

    // Clean up
    delete(x);
}
示例#2
0
const Integer Integer::power(const Integer a) const {
	if (a.compareTo(Integer::ZERO) < 0) {
		return Integer::ZERO;
	}
	if (a.compareTo(Integer::ZERO) == 0) {
		return Integer::ONE;
	}
	Integer ret(this->toString());
	Integer pow(a.toString());
	while (pow.compareTo(Integer::ONE) > 0) {
		ret = ret.multiply(*this);
		pow = pow.subtract(Integer::ONE);
	}
	return ret;
}
static void testPropertyValue()
{
	String s("abc");
	String ss = string("abc");
	Integer i(1);
	Integer ii = 1;
	Double d(2.2);
	Double dd = 2.2;
	Boolean b(true);
	Boolean bb = false;
	Byte byte('x');
	Byte bytebyte = 'x';

	cout << s.toString() << i.toString() << d.toString() << b.toString() << byte.toString() << endl;
	cout << ss.toString()<< ii.toString() << dd.toString() << bb.toString() << bytebyte.toString() << endl;

	cout << "Test PropertyValue Pass" << endl;
}
示例#4
0
Cardinality::Cardinality(const Integer& card) : d_card(card) {
  PrettyCheckArgument(card >= 0, card,
                      "Cardinality must be a nonnegative integer, not %s.",
                      card.toString().c_str());
  d_card += 1;
}
示例#5
0
CardinalityBeth::CardinalityBeth(const Integer& beth) : d_index(beth) {
  PrettyCheckArgument(beth >= 0, beth,
                      "Beth index must be a nonnegative integer, not %s.",
                      beth.toString().c_str());
}
示例#6
0
	DivisionResult(const Integer a, const Integer b) : result(a.toString()),	remainder(b.toString()) {}