def f(n): obj1 = ootype.new(A) obj2 = ootype.new(B) s1 = ootype.oostring(obj1, -1) s2 = ootype.oostring(obj2, -1) ch1 = s1.ll_stritem_nonneg(1) ch2 = s2.ll_stritem_nonneg(1) return ord(ch1) + ord(ch2)
def ll_int2oct(i, addPrefix): if not addPrefix or i==0: return oostring(i, 8) buf = new(StringBuilder) if i<0: if i == SPECIAL_VALUE: return SPECIAL_VALUE_OCT i = -i buf.ll_append_char('-') buf.ll_append_char('0') buf.ll_append(oostring(i, 8)) return buf.ll_build()
def ll_int2hex(i, addPrefix): if not addPrefix: return oostring(i, 16) buf = new(StringBuilder) if i<0: if i == SPECIAL_VALUE: return SPECIAL_VALUE_HEX i = -i buf.ll_append_char('-') buf.ll_append_char('0') buf.ll_append_char('x') buf.ll_append(oostring(i, 16)) return buf.ll_build()
def test_oohash(self): def f(n): s = ootype.oostring(n, -1) return s.ll_hash() res = self.interp_operations(f, [5]) assert res == ootype.oostring(5, -1).ll_hash()
def oof(ch): return ootype.oostring(ch, -1)
def f(n): s = ootype.oostring(n, -1) return s.ll_hash()
def _ll_1_oostring_root_foldable(s): return ootype.oostring(s, -1)
def _ll_1_oostring_char_foldable(ch): return ootype.oostring(ch, -1)
def oofakeimpl(fmt, x): return ootype.oostring(rarithmetic.formatd(fmt._str, x), -1)
def fn(i): s = ootype.oostring(42, -1) meth = s.ll_stritem_nonneg args = (i, ) return meth(*args)
def ll_int2dec(i): return oostring(i, 10)
def ll_float_str(repr, f): return oostring(f, -1)
def _ll_2_oostring_signed_foldable(n, base): return ootype.oostring(n, base)
def _ll_1_oostring_unsigned_foldable(n): return ootype.oostring(n, -1)
def to_rstr(s): if s is None: return ootype.null(ootype.String) return ootype.oostring(s, -1)
def fn(c): s1 = ootype.oostring("xy", -1) s2 = ootype.oostring("x" + chr(c), -1) assert (hash_whatever(ootype.typeOf(s1), s1) == hash_whatever(ootype.typeOf(s2), s2)) assert equal_whatever(ootype.typeOf(s1), s1, s2)
def fn(i): s = ootype.oostring(42, -1) meth = s.ll_stritem_nonneg args = (i,) return meth(*args)
def oofakeimpl(x, code, precision, flags): return ootype.oostring(rfloat.formatd(x, code, precision, flags), -1)
def oof(): return ootype.oostring(42, -1)
def ll_str(self, instance): return ootype.oostring(instance, -1)
def to_rstr(s): return ootype.oostring(s, -1)
def op_oostring(self, obj, base): return ootype.oostring(obj, base)
def ll_str(self, val): return ootype.oostring(self.name, -1)
def ll_chr2str(ch): return ootype.oostring(ch, -1)