Ronald Oussoren avatar Ronald Oussoren committed 6f1f311

- Scripts/gen_test_methods.py now creates testbndl2.m and test_methods2.py
with some conditional code to make sure we can perform all tests on MacOS X,
while not causing problems on GNUstep (which doesn't have a 'bool' type at
the moment).
- Add 'MAC_OS_X_VERSION*' values to the objc module, allows easier version
checking in Python (probably only usefull in the unittests).
- Remove ObjCErr_Set, which was basically a reimplementation of PyErr_Format
- Remove Scripts/allTestsTogether.py and Scripts/generate-stubs.py.
The former has been replaced by Scripts/runPyObjCTests, the latter has not
been relevant for ages (it was used to generate C code for method IMP's
before we switched to libffi).
- Also remove Scripts/extract_byref_signatures.py (no longer used),
Scripts/create_byref_module.py (likewise) and Scripts/clean-install (a
"handy for Ronald script" that is no longer used).
- More work on bringing the code closer to the coding style.
- Code cleanup
- Add more headerdoc documentation (headerdoc is fairly limited, might switch
to another tool...)
- Implement numeric operators for NSDecimal (all except **, divmod and the
bitwise operators). Implicit coercion to python numbers is not supported by
design.
NOTE: Inplace operators are also supported, NSDecimal is a mutable type.
- Operators now also work for NSDecimalNumber instances.
- Add a wrapper type for IMP, and implement wrappers for
methodForSelector: and instanceMethodForSelector:.
This work is not yet complet, see the TODO file for more information.
- The _AppKit and _Foundation packages now contain a list of classes in
the respective frameworks. This significantly speeds up importing the
AppKit and Foundation packages (30%+ on my system). This does make a clean
build of PyObjC slower (because the extensions get build twice).

Comments (0)

Files changed (58)

 
 .. _: http://sourceforge.net/tracker/index.php?func=detail&aid=777308&group_id=14534&atid=114534
 
+Code cleanup
+............
+
+* Check all error/exception messages
+
+* Check/cleanup error handling
+
+* Finish in-code documentation for the C code
+
 
 Cleanup Examples
 ................
 methods we cannot implement efficiently.
 
 And the same is true of OC_PythonArray
+
+Finish support for methodForSelector:
+-------------------------------------
+
+* All call_ functions in Foundation and AppKit should support calling 
+  IMP-wrappers.
+
+* You should be able to use an IMP as the implementation of a method in
+  a different class.
+
+* More unittests
+
+Make it possible to redefine classes
+....................................
+
+For IDE's it would be pretty usefull to be able to redefine classes. It should
+not be possible to redefine pure ObjC classes, and the redefined class should
+be in the same module (determined by name).
+
+Both are needed to avoid accidental errors (e.g. two modules definining a class
+with the same name, which is perfectly valid in plain Python).
+
+Rewrite packaging scripts
+.........................
+
+The scripts we use for doing releases should be cleaned up, generic 
+functionality should be made available for others.

pyobjc/Doc/api-notes-macosx.txt

 
   The context is an integer
 
+* ``methodForSelector:``, ``instanceMethodForSelector:``
+
+  These methods return instances of objc.IMP. The major difference with
+  Objective-C is that you don't have to, or even can, pass the selector to
+  the IMP. In other words, the interface is the same as for unbound
+  instance methods: you have to pass ``self`` and the method arguments.
+
+  WARNING: This interface is experimental and might change in a future version
+  of PyObjC.
 
 Class ``NSScriptObjectSpecifier``
 .................................

pyobjc/Lib/Foundation/test/test_nsdecimal.py

+#
+# Some tests for NSDecimal (C type) and NSDecimalNumber (Objective-C class)
+#
 import unittest
 from Foundation import *
+import operator
 
 class TestNSDecimal (unittest.TestCase):
     def testCreation(self):
         o = NSDecimalNumber.alloc().initWithDecimal_(p)
         self.assertEquals(o.description(), "1.1234")
 
+class NSDecimalOperators (unittest.TestCase):
+    def testAddition(self):
+        r = NSDecimal()
+        o = NSDecimal(1)
+        p = NSDecimal(2)
+
+        NSDecimalAdd(r, o, p, NSRoundPlain)
+        self.assertEquals(o+p, r)
+        self.assertEquals(o+2, r)
+        self.assertEquals(o+2L, r)
+        self.assertEquals(1+p, r)
+        self.assertEquals(1+p, r)
+
+        self.assertRaises(TypeError, operator.add, o, 1.2)
+        self.assertRaises(TypeError, operator.add, 1.2, o)
+
+    def testSubtraction(self):
+        r = NSDecimal()
+        o = NSDecimal(1)
+        p = NSDecimal(2)
+
+        NSDecimalSubtract(r, o, p, NSRoundPlain)
+        self.assertEquals(o-p, r)
+        self.assertEquals(o-2, r)
+        self.assertEquals(o-2L, r)
+        self.assertEquals(1-p, r)
+        self.assertEquals(1-p, r)
+
+        self.assertRaises(TypeError, operator.sub, o, 1.2)
+        self.assertRaises(TypeError, operator.sub, 1.2, o)
+
+    def testMultiplication(self):
+        r = NSDecimal()
+        o = NSDecimal(2)
+        p = NSDecimal(3)
+
+        NSDecimalMultiply(r, o, p, NSRoundPlain)
+        self.assertEquals(o*p, r)
+        self.assertEquals(o*3, r)
+        self.assertEquals(o*3L, r)
+        self.assertEquals(2*p, r)
+        self.assertEquals(2*p, r)
+
+        self.assertRaises(TypeError, operator.mul, o, 1.2)
+        self.assertRaises(TypeError, operator.mul, 1.2, o)
+
+    def testDivision(self):
+        r = NSDecimal()
+        o = NSDecimal(2)
+        p = NSDecimal(3)
+
+        NSDecimalDivide(r, o, p, NSRoundPlain)
+        self.assertEquals(o/p, r)
+        self.assertEquals(o/3, r)
+        self.assertEquals(o/3L, r)
+        self.assertEquals(2/p, r)
+        self.assertEquals(2/p, r)
+
+        self.assertRaises(TypeError, operator.div, o, 1.2)
+        self.assertRaises(TypeError, operator.div, 1.2, o)
+
+    def testPositive(self):
+        o = NSDecimal(2)
+        p = NSDecimal(-2)
+
+        self.assertEquals(+o, o)
+        self.assertEquals(+p, p)
+
+    def testNegative(self):
+        o = NSDecimal(2)
+        p = NSDecimal(-2)
+
+        self.assertEquals(-o, p)
+        self.assertEquals(-p, o)
+
+    def testAbs(self):
+        o = NSDecimal(2)
+        p = NSDecimal(-2)
+
+        self.assertEquals(abs(o), o)
+        self.assertEquals(abs(p), o)
+
+    def testBitwise(self):
+        o = NSDecimal(2)
+        p = NSDecimal(3)
+
+        self.assertRaises(TypeError, operator.and_, o, p)
+        self.assertRaises(TypeError, operator.or_, o, p)
+        self.assertRaises(TypeError, operator.not_, o, p)
+
+    def testPow(self):
+        o = NSDecimal(2)
+        p = NSDecimal(3)
+
+        self.assertRaises(TypeError, pow, o, p)
+        self.assertRaises(TypeError, pow, o, 2)
+        self.assertRaises(TypeError, pow, 2, o)
+
+    def testDivMod(self):
+        o = NSDecimal(2)
+        p = NSDecimal(3)
+
+        self.assertRaises(TypeError, divmod, o, p)
+        self.assertRaises(TypeError, divmod, o, 2)
+        self.assertRaises(TypeError, divmod, 2, o)
+
+    def testInplaceAddition(self):
+        r = NSDecimal()
+        o = NSDecimal(1)
+        p = NSDecimal(2)
+
+        NSDecimalAdd(r, o, p, NSRoundPlain)
+
+        o = NSDecimal(1)
+        o += p
+        self.assertEquals(o, r)
+
+        o = NSDecimal(1)
+        o += 2
+        self.assertEquals(o, r)
+
+        o = NSDecimal(1)
+        o += 2L
+        self.assertEquals(o, r)
+
+        o = 1
+        o += p
+        self.assertEquals(o, r)
+
+        o = 1L
+        o += p
+        self.assertEquals(o, r)
+
+        try:
+            o = 1.2
+            o += p
+            self.fail()
+        except TypeError:
+            pass
+
+        try:
+            o = NSDecimal(1)
+            o += 1.2
+            self.fail()
+        except TypeError:
+            pass
+
+    def testInplaceSubtraction(self):
+        r = NSDecimal()
+        o = NSDecimal(1)
+        p = NSDecimal(2)
+
+        NSDecimalSubtract(r, o, p, NSRoundPlain)
+
+        o = NSDecimal(1)
+        o -= p
+        self.assertEquals(o, r)
+
+        o = NSDecimal(1)
+        o -= 2
+        self.assertEquals(o, r)
+
+        o = NSDecimal(1)
+        o -= 2
+        self.assertEquals(o, r)
+
+        o = 1
+        o -= p
+        self.assertEquals(o, r)
+
+        o = 1
+        o -= p
+        self.assertEquals(o, r)
+
+    def testInplaceMultiplication(self):
+        r = NSDecimal()
+        o = NSDecimal(2)
+        p = NSDecimal(3)
+
+        NSDecimalMultiply(r, o, p, NSRoundPlain)
+
+        o = NSDecimal(2)
+        o *= p
+        self.assertEquals(o, r)
+
+        o = NSDecimal(2)
+        o *= 3
+        self.assertEquals(o, r)
+
+        o = NSDecimal(2)
+        o *= 3L
+        self.assertEquals(o, r)
+
+        o = 2
+        o *= p
+        self.assertEquals(o, r)
+
+        o = 2L
+        o *= p
+        self.assertEquals(o, r)
+
+    def testInplaceDivision(self):
+        r = NSDecimal()
+        o = NSDecimal(2)
+        p = NSDecimal(3)
+
+        NSDecimalDivide(r, o, p, NSRoundPlain)
+
+        o = NSDecimal(2)
+        o /= p
+        self.assertEquals(o, r)
+
+        o = NSDecimal(2)
+        o /= 3
+        self.assertEquals(o, r)
+
+        o = NSDecimal(2)
+        o /= 3L
+        self.assertEquals(o, r)
+
+        o = 2
+        o /= p
+        self.assertEquals(o, r)
+
+        o = 2L
+        o /= p
+        self.assertEquals(o, r)
+
+class NSDecimalNumberOperators (unittest.TestCase):
+    def testAddition(self):
+        r = NSDecimal()
+        o = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(1))
+        p = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(2))
+
+        NSDecimalAdd(r, o.decimalValue(), p.decimalValue(), NSRoundPlain)
+        self.assertEquals((o+p).decimalValue(), r)
+        self.assertEquals((o+2).decimalValue(), r)
+        self.assertEquals((o+2L).decimalValue(), r)
+        self.assertEquals((1+p).decimalValue(), r)
+        self.assertEquals((1+p).decimalValue(), r)
+
+        self.assertRaises(TypeError, operator.add, o, 1.2)
+        self.assertRaises(TypeError, operator.add, 1.2, o)
+
+    def testSubtraction(self):
+        r = NSDecimal()
+        o = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(1))
+        p = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(2))
+
+        NSDecimalSubtract(r, o.decimalValue(), p.decimalValue(), NSRoundPlain)
+        self.assertEquals((o-p).decimalValue(), r)
+        self.assertEquals((o-2).decimalValue(), r)
+        self.assertEquals((o-2L).decimalValue(), r)
+        self.assertEquals((1-p).decimalValue(), r)
+        self.assertEquals((1-p).decimalValue(), r)
+
+        self.assertRaises(TypeError, operator.sub, o, 1.2)
+        self.assertRaises(TypeError, operator.sub, 1.2, o)
+
+    def testMultiplication(self):
+        r = NSDecimal()
+        o = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(2))
+        p = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(3))
+
+        NSDecimalMultiply(r, o.decimalValue(), p.decimalValue(), NSRoundPlain)
+        self.assertEquals((o*p).decimalValue(), r)
+        self.assertEquals((o*3).decimalValue(), r)
+        self.assertEquals((o*3L).decimalValue(), r)
+        self.assertEquals((2*p).decimalValue(), r)
+        self.assertEquals((2*p).decimalValue(), r)
+
+        self.assertRaises(TypeError, operator.mul, o, 1.2)
+        self.assertRaises(TypeError, operator.mul, 1.2, o)
+
+    def testDivision(self):
+        r = NSDecimal()
+        o = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(2))
+        p = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(3))
+
+        NSDecimalDivide(r, o.decimalValue(), p.decimalValue(), NSRoundPlain)
+        self.assertEquals((o/p).decimalValue(), r)
+        self.assertEquals((o/3).decimalValue(), r)
+        self.assertEquals((o/3L).decimalValue(), r)
+        self.assertEquals((2/p).decimalValue(), r)
+        self.assertEquals((2/p).decimalValue(), r)
+
+        self.assertRaises(TypeError, operator.div, o, 1.2)
+        self.assertRaises(TypeError, operator.div, 1.2, o)
+
+    def testPositive(self):
+        o = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(2))
+        p = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(-2))
+
+        self.assertEquals((+o).decimalValue(), o.decimalValue())
+        self.assertEquals((+p).decimalValue(), p.decimalValue())
+
+    def testNegative(self):
+        o = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(2))
+        p = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(-2))
+
+        self.assertEquals((-o).decimalValue(), p.decimalValue())
+        self.assertEquals((-p).decimalValue(), o.decimalValue())
+
+    def testAbs(self):
+        o = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(2))
+        p = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(-2))
+
+        self.assertEquals(abs(o).decimalValue(), o.decimalValue())
+        self.assertEquals(abs(p).decimalValue(), o.decimalValue())
+
+    def testBitwise(self):
+        o = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(2))
+        p = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(-2))
+
+        self.assertRaises(TypeError, operator.and_, o, p)
+        self.assertRaises(TypeError, operator.or_, o, p)
+        self.assertRaises(TypeError, operator.not_, o, p)
+
+    def testPow(self):
+        o = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(2))
+        p = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(-2))
+
+        self.assertRaises(TypeError, pow, o, p)
+        self.assertRaises(TypeError, pow, o, 2)
+        self.assertRaises(TypeError, pow, 2, o)
+
+    def testDivMod(self):
+        o = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(2))
+        p = NSDecimalNumber.decimalNumberWithDecimal_(NSDecimal(-2))
+
+        self.assertRaises(TypeError, divmod, o, p)
+        self.assertRaises(TypeError, divmod, o, 2)
+        self.assertRaises(TypeError, divmod, 2, o)
+
 if __name__ == "__main__":
     unittest.main()

pyobjc/Lib/Foundation/test/test_nsdictionary.py

 import types
 import sys
 
+from objc.test.testbndl import PyObjC_TestClass3
+
 from Foundation import *
 
 
         self.assert_(y['two'] == 2)
         self.assert_(z['four'] == 4)
 
+
+class MyDictionaryBase (NSDictionary):
+    def count(self):
+        if hasattr(self, '_count'):
+            return self._count
+        return -1
+
+    def keyEnumerator(self):
+        return None
+
+    def objectForKey(self, key):
+        return None
+   
+class MyDictionary1 (MyDictionaryBase):
+    def initWithObjects_forKeys_count_(self, objects, keys, count):
+        self.count = count
+        self.objects = objects
+        self.keys = keys
+        return self
+
+class MyDictionary2 (MyDictionaryBase):
+    def dictionaryWithObjects_forKeys_count_(self, objects, keys, count):
+        if not self is MyDictionary2: raise AssertionError, self
+        return (objects, keys, count)
+
+class TestSubclassing (unittest.TestCase):
+    def testInitWithObjects(self):
+        o = PyObjC_TestClass3.makeDictFromClass_method_(MyDictionary1, 1)
+        
+        self.assert_(isinstance(o, MyDictionary1))
+        self.assertEquals(o.count, 4)
+        self.assertEquals(len(o.keys), 4)
+        self.assertEquals(len(o.objects), 4)
+
+    def testDictWithObjects(self):
+        o = PyObjC_TestClass3.makeDictFromClass_method_(MyDictionary2, 0)
+        
+        self.assert_(isinstance(o, tuple))
+        self.assertEquals(o[2], 4)
+        self.assertEquals(len(o[1]), 4)
+        self.assertEquals(len(o[0]), 4)
+
 if __name__ == '__main__':
     unittest.main( )

pyobjc/Lib/objc/_convenience.py

 # NSNumber seems to be and abstract base-class that is implemented using
 # NSCFNumber, a CoreFoundation 'proxy'.
 #
+NSDecimalNumber = runtime.NSDecimalNumber
+from _Foundation import NSDecimal
+
 def _num_to_python(v):
     """
     Magic method that converts NSNumber values to Python, see 
     <Foundation/CFNumber.h> for the magic numbers
     """
-    if hasattr(v, '_cfNumberType'):
+    global NSDecimal
+
+    if isinstance(v, NSDecimalNumber):
+        return v.decimalValue()
+
+    elif hasattr(v, '_cfNumberType'):
         tp = v._cfNumberType()
         if tp in [ 1, 2, 3, 7, 8, 9, 10 ]:
             v = v.longValue()
     return v
 
 def __abs__CFNumber(numA):
-    return abs(_num_to_python(numA))
+    r =  abs(_num_to_python(numA))
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __add__CFNumber(numA, numB):
-    return _num_to_python(numA) + _num_to_python(numB)
+    r = _num_to_python(numA) + _num_to_python(numB)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __and__CFNumber(numA, numB):
-    return _num_to_python(numA) & _num_to_python(numB)
+    r = _num_to_python(numA) & _num_to_python(numB)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __div__CFNumber(numA, numB):
-    return _num_to_python(numA) / _num_to_python(numB)
+    r = _num_to_python(numA) / _num_to_python(numB)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __divmod__CFNumber(numA, numB):
-    return divmod(_num_to_python(numA), _num_to_python(numB))
+    r = divmod(_num_to_python(numA), _num_to_python(numB))
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __float__CFNumber(numA):
-    return float(_num_to_python(numA))
+    r = float(_num_to_python(numA))
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __floordiv__CFNumber(numA, numB):
-    return _num_to_python(numA) // _num_to_python(numB)
+    r = _num_to_python(numA) // _num_to_python(numB)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __hex__CFNumber(numA):
     return hex(_num_to_python(numA))
     return int(_num_to_python(numA))
 
 def __invert__CFNumber(numA):
-    return ~_num_to_python(numA)
+    r = ~_num_to_python(numA)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __long__CFNumber(numA):
     return long(_num_to_python(numA))
 
 def __lshift__CFNumber(numA, numB):
-    return _num_to_python(numA) << _num_to_python(numB)
+    r = _num_to_python(numA) << _num_to_python(numB)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __rshift__CFNumber(numA, numB):
-    return _num_to_python(numA) >> _num_to_python(numB)
+    r = _num_to_python(numA) >> _num_to_python(numB)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __mod__CFNumber(numA, numB):
-    return _num_to_python(numA) % _num_to_python(numB)
+    r = _num_to_python(numA) % _num_to_python(numB)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __mul__CFNumber(numA, numB):
-    return _num_to_python(numA) * _num_to_python(numB)
+    r = _num_to_python(numA) * _num_to_python(numB)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __neg__CFNumber(numA):
-    return -_num_to_python(numA)
+    r = -_num_to_python(numA)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __oct__CFNumber(numA):
     return oct(_num_to_python(numA))
 
 def __or__CFNumber(numA, numB):
-    return _num_to_python(numA)  | _num_to_python(numB)
+    r = _num_to_python(numA)  | _num_to_python(numB)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __pos__CFNumber(numA):
-    return +_num_to_python(numA)
+    r = +_num_to_python(numA)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __pow__CFNumber(numA, numB, modulo=None):
     if modulo is None:
-        return _num_to_python(numA)  ** _num_to_python(numB)
+        r = _num_to_python(numA)  ** _num_to_python(numB)
     else:
-        return pow(_num_to_python(numA), _num_to_python(numB), modulo)
+        r = pow(_num_to_python(numA), _num_to_python(numB), modulo)
+    
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __sub__CFNumber(numA, numB):
-    return _num_to_python(numA)  - _num_to_python(numB)
+    r = _num_to_python(numA)  - _num_to_python(numB)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __truediv__CFNumber(numA, numB):
-    return _num_to_python(numA) / _num_to_python(numB)
+    r = _num_to_python(numA) / _num_to_python(numB)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 def __xor__CFNumber(numA, numB):
-    return _num_to_python(numA)  ^ _num_to_python(numB)
+    r = _num_to_python(numA)  ^ _num_to_python(numB)
+    if isinstance(r, NSDecimal):
+        return NSDecimalNumber.decimalNumberWithDecimal_(r)
+    else:
+        return r
 
 import __builtin__
 if not hasattr(__builtin__, 'bool'):

pyobjc/Lib/objc/test/test_methods2.py

 
 # First make sure that the pass-by-reference methods have the correct signature
 setSignature = objc.setSignatureForSelector
-setSignature("PyObjC_TestClass1", "BOOLInOutArg:", "@@:N^C")
-setSignature("PyObjC_TestClass1", "BOOLOutArg:", "v@:o^C")
-setSignature("PyObjC_TestClass1", "BOOLInArg:", "@@:n^C")
-setSignature("PyObjC_TestClass2", "callBOOLInOutArg:of:", "@@:N^C@")
-setSignature("PyObjC_TestClass2", "callBOOLOutArg:of:", "v@:o^C@")
-setSignature("PyObjC_TestClass2", "callBOOLInArg:of:", "@@:n^C@")
-setSignature("PyObjC_TestClass2", "invokeBOOLInOutArg:of:", "@@:N^C@")
-setSignature("PyObjC_TestClass2", "invokeBOOLOutArg:of:", "v@:o^C@")
-setSignature("PyObjC_TestClass2", "invokeBOOLInArg:of:", "@@:n^C@")
+
+# FIXME
+import sys
+HAVE_BOOL=sys.platform == 'darwin'
+if HAVE_BOOL: setSignature("PyObjC_TestClass1", "boolInOutArg:", "@@:N^B")
+if HAVE_BOOL: setSignature("PyObjC_TestClass1", "boolOutArg:", "v@:o^B")
+if HAVE_BOOL: setSignature("PyObjC_TestClass1", "boolInArg:", "@@:n^B")
+if HAVE_BOOL: setSignature("PyObjC_TestClass2", "callboolInOutArg:of:", "@@:N^B@")
+if HAVE_BOOL: setSignature("PyObjC_TestClass2", "callboolOutArg:of:", "v@:o^B@")
+if HAVE_BOOL: setSignature("PyObjC_TestClass2", "callboolInArg:of:", "@@:n^B@")
+if HAVE_BOOL: setSignature("PyObjC_TestClass2", "invokeboolInOutArg:of:", "@@:N^B@")
+if HAVE_BOOL: setSignature("PyObjC_TestClass2", "invokeboolOutArg:of:", "v@:o^B@")
+if HAVE_BOOL: setSignature("PyObjC_TestClass2", "invokeboolInArg:of:", "@@:n^B@")
+setSignature("PyObjC_TestClass1", "BOOLInOutArg:", "@@:N^c")
+setSignature("PyObjC_TestClass1", "BOOLOutArg:", "v@:o^c")
+setSignature("PyObjC_TestClass1", "BOOLInArg:", "@@:n^c")
+setSignature("PyObjC_TestClass2", "callBOOLInOutArg:of:", "@@:N^c@")
+setSignature("PyObjC_TestClass2", "callBOOLOutArg:of:", "v@:o^c@")
+setSignature("PyObjC_TestClass2", "callBOOLInArg:of:", "@@:n^c@")
+setSignature("PyObjC_TestClass2", "invokeBOOLInOutArg:of:", "@@:N^c@")
+setSignature("PyObjC_TestClass2", "invokeBOOLOutArg:of:", "v@:o^c@")
+setSignature("PyObjC_TestClass2", "invokeBOOLInArg:of:", "@@:n^c@")
 setSignature("PyObjC_TestClass1", "charInOutArg:", "@@:N^c")
 setSignature("PyObjC_TestClass1", "charOutArg:", "v@:o^c")
 setSignature("PyObjC_TestClass1", "charInArg:", "@@:n^c")
 	# Test calling Objective-C from Python
 	# Simple returns from class methods
 
+	def testClsboolResult(self):
+		if not HAVE_BOOL: return
+		PyObjC_TestClass1.clsReset()
+		self.assertEquals(PyObjC_TestClass1.boolClsMethod(), YES)
+		self.assertEquals(PyObjC_TestClass1.boolClsMethod(), NO)
+
+
 	def testClsBOOLResult(self):
 		PyObjC_TestClass1.clsReset()
 		self.assertEquals(PyObjC_TestClass1.BOOLClsMethod(), YES)
 
 	# Simple returns from instance methods
 
+	def testboolResult(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		o.reset()
+		self.assertEquals(o.boolMethod(), YES)
+		self.assertEquals(o.boolMethod(), NO)
+
+
 	def testBOOLResult(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 
 	# One argument
 
+	def testboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_(YES)
+		self.assertEquals(r, YES)
+		r = o.boolArg_(NO)
+		self.assertEquals(r, NO)
+
+
 	def testBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 
 	# Two arguments
 
+	def testboolAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andboolArg_(YES, YES)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], YES)
+		r = o.boolArg_andboolArg_(YES, NO)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], NO)
+		r = o.boolArg_andboolArg_(NO, YES)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], YES)
+		r = o.boolArg_andboolArg_(NO, NO)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], NO)
+
+
+	def testboolAndBOOLArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andBOOLArg_(YES, YES)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], YES)
+		r = o.boolArg_andBOOLArg_(YES, NO)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], NO)
+		r = o.boolArg_andBOOLArg_(NO, YES)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], YES)
+		r = o.boolArg_andBOOLArg_(NO, NO)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], NO)
+
+
+	def testboolAndcharArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andcharArg_(YES, -128)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], -128)
+		r = o.boolArg_andcharArg_(YES, 0)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andcharArg_(YES, 127)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 127)
+		r = o.boolArg_andcharArg_(NO, -128)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], -128)
+		r = o.boolArg_andcharArg_(NO, 0)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andcharArg_(NO, 127)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 127)
+
+
+	def testboolAndsignedshortArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andsignedshortArg_(YES, -(1<<14))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], -(1<<14))
+		r = o.boolArg_andsignedshortArg_(YES, -42)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], -42)
+		r = o.boolArg_andsignedshortArg_(YES, 0)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andsignedshortArg_(YES, 42)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andsignedshortArg_(YES, 1 << 14)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 1 << 14)
+		r = o.boolArg_andsignedshortArg_(NO, -(1<<14))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], -(1<<14))
+		r = o.boolArg_andsignedshortArg_(NO, -42)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], -42)
+		r = o.boolArg_andsignedshortArg_(NO, 0)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andsignedshortArg_(NO, 42)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andsignedshortArg_(NO, 1 << 14)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 1 << 14)
+
+
+	def testboolAndsignedintArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andsignedintArg_(YES, -(1<<30))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], -(1<<30))
+		r = o.boolArg_andsignedintArg_(YES, -42)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], -42)
+		r = o.boolArg_andsignedintArg_(YES, 0)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andsignedintArg_(YES, 42)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andsignedintArg_(YES, 1 << 30)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 1 << 30)
+		r = o.boolArg_andsignedintArg_(NO, -(1<<30))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], -(1<<30))
+		r = o.boolArg_andsignedintArg_(NO, -42)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], -42)
+		r = o.boolArg_andsignedintArg_(NO, 0)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andsignedintArg_(NO, 42)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andsignedintArg_(NO, 1 << 30)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 1 << 30)
+
+
+	def testboolAndsignedlongArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andsignedlongArg_(YES, -(1<<30))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], -(1<<30))
+		r = o.boolArg_andsignedlongArg_(YES, -42)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], -42)
+		r = o.boolArg_andsignedlongArg_(YES, 0)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andsignedlongArg_(YES, 42)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andsignedlongArg_(YES, 1 << 30)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 1 << 30)
+		r = o.boolArg_andsignedlongArg_(NO, -(1<<30))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], -(1<<30))
+		r = o.boolArg_andsignedlongArg_(NO, -42)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], -42)
+		r = o.boolArg_andsignedlongArg_(NO, 0)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andsignedlongArg_(NO, 42)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andsignedlongArg_(NO, 1 << 30)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 1 << 30)
+
+
+	def testboolAndsignedlonglongArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andsignedlonglongArg_(YES, -(1L << 60))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], -(1L << 60))
+		r = o.boolArg_andsignedlonglongArg_(YES, -42)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], -42)
+		r = o.boolArg_andsignedlonglongArg_(YES, 0)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andsignedlonglongArg_(YES, 42)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andsignedlonglongArg_(YES, 1L << 60)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 1L << 60)
+		r = o.boolArg_andsignedlonglongArg_(NO, -(1L << 60))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], -(1L << 60))
+		r = o.boolArg_andsignedlonglongArg_(NO, -42)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], -42)
+		r = o.boolArg_andsignedlonglongArg_(NO, 0)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andsignedlonglongArg_(NO, 42)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andsignedlonglongArg_(NO, 1L << 60)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 1L << 60)
+
+
+	def testboolAndunsignedcharArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andunsignedcharArg_(YES, 0)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andunsignedcharArg_(YES, 128)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 128)
+		r = o.boolArg_andunsignedcharArg_(YES, 255)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 255)
+		r = o.boolArg_andunsignedcharArg_(NO, 0)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andunsignedcharArg_(NO, 128)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 128)
+		r = o.boolArg_andunsignedcharArg_(NO, 255)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 255)
+
+
+	def testboolAndunsignedshortArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andunsignedshortArg_(YES, 0)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andunsignedshortArg_(YES, 42)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andunsignedshortArg_(YES, 1<<14)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 1<<14)
+		r = o.boolArg_andunsignedshortArg_(NO, 0)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andunsignedshortArg_(NO, 42)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andunsignedshortArg_(NO, 1<<14)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 1<<14)
+
+
+	def testboolAndunsignedintArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andunsignedintArg_(YES, 0)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andunsignedintArg_(YES, 42)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andunsignedintArg_(YES, 1 << 30)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 1 << 30)
+		r = o.boolArg_andunsignedintArg_(NO, 0)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andunsignedintArg_(NO, 42)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andunsignedintArg_(NO, 1 << 30)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 1 << 30)
+
+
+	def testboolAndunsignedlongArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andunsignedlongArg_(YES, 0)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andunsignedlongArg_(YES, 42)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andunsignedlongArg_(YES, 1L << 30)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 1L << 30)
+		r = o.boolArg_andunsignedlongArg_(NO, 0)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andunsignedlongArg_(NO, 42)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andunsignedlongArg_(NO, 1L << 30)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 1L << 30)
+
+
+	def testboolAndunsignedlonglongArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andunsignedlonglongArg_(YES, 0)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andunsignedlonglongArg_(YES, 42)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andunsignedlonglongArg_(YES, 1L << 62)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], 1L << 62)
+		r = o.boolArg_andunsignedlonglongArg_(NO, 0)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 0)
+		r = o.boolArg_andunsignedlonglongArg_(NO, 42)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 42)
+		r = o.boolArg_andunsignedlonglongArg_(NO, 1L << 62)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], 1L << 62)
+
+
+	def testboolAndfloatArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andfloatArg_(YES, 0.128)
+		self.assertEquals(r[0], YES)
+		self.assertAlmostEquals(r[1], 0.128)
+		r = o.boolArg_andfloatArg_(YES, 1.0)
+		self.assertEquals(r[0], YES)
+		self.assertAlmostEquals(r[1], 1.0)
+		r = o.boolArg_andfloatArg_(YES, 42.0)
+		self.assertEquals(r[0], YES)
+		self.assertAlmostEquals(r[1], 42.0)
+		r = o.boolArg_andfloatArg_(YES, 1e10)
+		self.assertEquals(r[0], YES)
+		self.assertAlmostEquals(r[1], 1e10)
+		r = o.boolArg_andfloatArg_(NO, 0.128)
+		self.assertEquals(r[0], NO)
+		self.assertAlmostEquals(r[1], 0.128)
+		r = o.boolArg_andfloatArg_(NO, 1.0)
+		self.assertEquals(r[0], NO)
+		self.assertAlmostEquals(r[1], 1.0)
+		r = o.boolArg_andfloatArg_(NO, 42.0)
+		self.assertEquals(r[0], NO)
+		self.assertAlmostEquals(r[1], 42.0)
+		r = o.boolArg_andfloatArg_(NO, 1e10)
+		self.assertEquals(r[0], NO)
+		self.assertAlmostEquals(r[1], 1e10)
+
+
+	def testboolAnddoubleArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_anddoubleArg_(YES, 0.128)
+		self.assertEquals(r[0], YES)
+		self.assertAlmostEquals(r[1], 0.128)
+		r = o.boolArg_anddoubleArg_(YES, 1.0)
+		self.assertEquals(r[0], YES)
+		self.assertAlmostEquals(r[1], 1.0)
+		r = o.boolArg_anddoubleArg_(YES, 42.0)
+		self.assertEquals(r[0], YES)
+		self.assertAlmostEquals(r[1], 42.0)
+		r = o.boolArg_anddoubleArg_(YES, 1e10)
+		self.assertEquals(r[0], YES)
+		self.assertAlmostEquals(r[1], 1e10)
+		r = o.boolArg_anddoubleArg_(NO, 0.128)
+		self.assertEquals(r[0], NO)
+		self.assertAlmostEquals(r[1], 0.128)
+		r = o.boolArg_anddoubleArg_(NO, 1.0)
+		self.assertEquals(r[0], NO)
+		self.assertAlmostEquals(r[1], 1.0)
+		r = o.boolArg_anddoubleArg_(NO, 42.0)
+		self.assertEquals(r[0], NO)
+		self.assertAlmostEquals(r[1], 42.0)
+		r = o.boolArg_anddoubleArg_(NO, 1e10)
+		self.assertEquals(r[0], NO)
+		self.assertAlmostEquals(r[1], 1e10)
+
+
+	def testboolAndidArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andidArg_(YES, NSPriorDayDesignations)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], NSPriorDayDesignations)
+		r = o.boolArg_andidArg_(NO, NSPriorDayDesignations)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], NSPriorDayDesignations)
+
+
+	def testboolAndcharPtrArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andcharPtrArg_(YES, "hello")
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], "hello")
+		r = o.boolArg_andcharPtrArg_(YES, "world")
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], "world")
+		r = o.boolArg_andcharPtrArg_(YES, "foobar")
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], "foobar")
+		r = o.boolArg_andcharPtrArg_(NO, "hello")
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], "hello")
+		r = o.boolArg_andcharPtrArg_(NO, "world")
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], "world")
+		r = o.boolArg_andcharPtrArg_(NO, "foobar")
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], "foobar")
+
+
+	def testboolAndNSPointArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andNSPointArg_(YES, (1, 2))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], (1, 2))
+		r = o.boolArg_andNSPointArg_(YES, (3, 4))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], (3, 4))
+		r = o.boolArg_andNSPointArg_(NO, (1, 2))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], (1, 2))
+		r = o.boolArg_andNSPointArg_(NO, (3, 4))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], (3, 4))
+
+
+	def testboolAndNSRectArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andNSRectArg_(YES, ((1, 2), (3, 4)))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], ((1, 2), (3, 4)))
+		r = o.boolArg_andNSRectArg_(YES, ((7, 8), (9, 10)))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], ((7, 8), (9, 10)))
+		r = o.boolArg_andNSRectArg_(NO, ((1, 2), (3, 4)))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], ((1, 2), (3, 4)))
+		r = o.boolArg_andNSRectArg_(NO, ((7, 8), (9, 10)))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], ((7, 8), (9, 10)))
+
+
+	def testboolAndstructTestStruct1Arg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andstructTestStruct1Arg_(YES, (1, 2, (1, 2, 3, 4, 5)))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], (1, 2, (1, 2, 3, 4, 5)))
+		r = o.boolArg_andstructTestStruct1Arg_(YES, (9, 8, (-1, -2, -3, -4, -5)))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], (9, 8, (-1, -2, -3, -4, -5)))
+		r = o.boolArg_andstructTestStruct1Arg_(NO, (1, 2, (1, 2, 3, 4, 5)))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], (1, 2, (1, 2, 3, 4, 5)))
+		r = o.boolArg_andstructTestStruct1Arg_(NO, (9, 8, (-1, -2, -3, -4, -5)))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], (9, 8, (-1, -2, -3, -4, -5)))
+
+
+	def testboolAndstructTestStruct2Arg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andstructTestStruct2Arg_(YES, (1, 2, (1, 2, 3, 4, 5)))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], (1, 2, (1, 2, 3, 4, 5)))
+		r = o.boolArg_andstructTestStruct2Arg_(YES, (9, 8, (-1, -2, -3, -4, -5)))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], (9, 8, (-1, -2, -3, -4, -5)))
+		r = o.boolArg_andstructTestStruct2Arg_(NO, (1, 2, (1, 2, 3, 4, 5)))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], (1, 2, (1, 2, 3, 4, 5)))
+		r = o.boolArg_andstructTestStruct2Arg_(NO, (9, 8, (-1, -2, -3, -4, -5)))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], (9, 8, (-1, -2, -3, -4, -5)))
+
+
+	def testboolAndstructTestStruct3Arg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolArg_andstructTestStruct3Arg_(YES, (1, 2))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], (1, 2))
+		r = o.boolArg_andstructTestStruct3Arg_(YES, (2, 4))
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], (2, 4))
+		r = o.boolArg_andstructTestStruct3Arg_(NO, (1, 2))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], (1, 2))
+		r = o.boolArg_andstructTestStruct3Arg_(NO, (2, 4))
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], (2, 4))
+
+
+	def testBOOLAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.BOOLArg_andboolArg_(YES, YES)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], YES)
+		r = o.BOOLArg_andboolArg_(YES, NO)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], NO)
+		r = o.BOOLArg_andboolArg_(NO, YES)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], YES)
+		r = o.BOOLArg_andboolArg_(NO, NO)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], NO)
+
+
 	def testBOOLAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testcharAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.charArg_andboolArg_(-128, YES)
+		self.assertEquals(r[0], -128)
+		self.assertEquals(r[1], YES)
+		r = o.charArg_andboolArg_(-128, NO)
+		self.assertEquals(r[0], -128)
+		self.assertEquals(r[1], NO)
+		r = o.charArg_andboolArg_(0, YES)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], YES)
+		r = o.charArg_andboolArg_(0, NO)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], NO)
+		r = o.charArg_andboolArg_(127, YES)
+		self.assertEquals(r[0], 127)
+		self.assertEquals(r[1], YES)
+		r = o.charArg_andboolArg_(127, NO)
+		self.assertEquals(r[0], 127)
+		self.assertEquals(r[1], NO)
+
+
 	def testcharAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testsignedshortAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.signedshortArg_andboolArg_(-(1<<14), YES)
+		self.assertEquals(r[0], -(1<<14))
+		self.assertEquals(r[1], YES)
+		r = o.signedshortArg_andboolArg_(-(1<<14), NO)
+		self.assertEquals(r[0], -(1<<14))
+		self.assertEquals(r[1], NO)
+		r = o.signedshortArg_andboolArg_(-42, YES)
+		self.assertEquals(r[0], -42)
+		self.assertEquals(r[1], YES)
+		r = o.signedshortArg_andboolArg_(-42, NO)
+		self.assertEquals(r[0], -42)
+		self.assertEquals(r[1], NO)
+		r = o.signedshortArg_andboolArg_(0, YES)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], YES)
+		r = o.signedshortArg_andboolArg_(0, NO)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], NO)
+		r = o.signedshortArg_andboolArg_(42, YES)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], YES)
+		r = o.signedshortArg_andboolArg_(42, NO)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], NO)
+		r = o.signedshortArg_andboolArg_(1 << 14, YES)
+		self.assertEquals(r[0], 1 << 14)
+		self.assertEquals(r[1], YES)
+		r = o.signedshortArg_andboolArg_(1 << 14, NO)
+		self.assertEquals(r[0], 1 << 14)
+		self.assertEquals(r[1], NO)
+
+
 	def testsignedshortAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testsignedintAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.signedintArg_andboolArg_(-(1<<30), YES)
+		self.assertEquals(r[0], -(1<<30))
+		self.assertEquals(r[1], YES)
+		r = o.signedintArg_andboolArg_(-(1<<30), NO)
+		self.assertEquals(r[0], -(1<<30))
+		self.assertEquals(r[1], NO)
+		r = o.signedintArg_andboolArg_(-42, YES)
+		self.assertEquals(r[0], -42)
+		self.assertEquals(r[1], YES)
+		r = o.signedintArg_andboolArg_(-42, NO)
+		self.assertEquals(r[0], -42)
+		self.assertEquals(r[1], NO)
+		r = o.signedintArg_andboolArg_(0, YES)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], YES)
+		r = o.signedintArg_andboolArg_(0, NO)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], NO)
+		r = o.signedintArg_andboolArg_(42, YES)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], YES)
+		r = o.signedintArg_andboolArg_(42, NO)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], NO)
+		r = o.signedintArg_andboolArg_(1 << 30, YES)
+		self.assertEquals(r[0], 1 << 30)
+		self.assertEquals(r[1], YES)
+		r = o.signedintArg_andboolArg_(1 << 30, NO)
+		self.assertEquals(r[0], 1 << 30)
+		self.assertEquals(r[1], NO)
+
+
 	def testsignedintAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testsignedlongAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.signedlongArg_andboolArg_(-(1<<30), YES)
+		self.assertEquals(r[0], -(1<<30))
+		self.assertEquals(r[1], YES)
+		r = o.signedlongArg_andboolArg_(-(1<<30), NO)
+		self.assertEquals(r[0], -(1<<30))
+		self.assertEquals(r[1], NO)
+		r = o.signedlongArg_andboolArg_(-42, YES)
+		self.assertEquals(r[0], -42)
+		self.assertEquals(r[1], YES)
+		r = o.signedlongArg_andboolArg_(-42, NO)
+		self.assertEquals(r[0], -42)
+		self.assertEquals(r[1], NO)
+		r = o.signedlongArg_andboolArg_(0, YES)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], YES)
+		r = o.signedlongArg_andboolArg_(0, NO)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], NO)
+		r = o.signedlongArg_andboolArg_(42, YES)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], YES)
+		r = o.signedlongArg_andboolArg_(42, NO)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], NO)
+		r = o.signedlongArg_andboolArg_(1 << 30, YES)
+		self.assertEquals(r[0], 1 << 30)
+		self.assertEquals(r[1], YES)
+		r = o.signedlongArg_andboolArg_(1 << 30, NO)
+		self.assertEquals(r[0], 1 << 30)
+		self.assertEquals(r[1], NO)
+
+
 	def testsignedlongAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testsignedlonglongAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.signedlonglongArg_andboolArg_(-(1L << 60), YES)
+		self.assertEquals(r[0], -(1L << 60))
+		self.assertEquals(r[1], YES)
+		r = o.signedlonglongArg_andboolArg_(-(1L << 60), NO)
+		self.assertEquals(r[0], -(1L << 60))
+		self.assertEquals(r[1], NO)
+		r = o.signedlonglongArg_andboolArg_(-42, YES)
+		self.assertEquals(r[0], -42)
+		self.assertEquals(r[1], YES)
+		r = o.signedlonglongArg_andboolArg_(-42, NO)
+		self.assertEquals(r[0], -42)
+		self.assertEquals(r[1], NO)
+		r = o.signedlonglongArg_andboolArg_(0, YES)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], YES)
+		r = o.signedlonglongArg_andboolArg_(0, NO)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], NO)
+		r = o.signedlonglongArg_andboolArg_(42, YES)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], YES)
+		r = o.signedlonglongArg_andboolArg_(42, NO)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], NO)
+		r = o.signedlonglongArg_andboolArg_(1L << 60, YES)
+		self.assertEquals(r[0], 1L << 60)
+		self.assertEquals(r[1], YES)
+		r = o.signedlonglongArg_andboolArg_(1L << 60, NO)
+		self.assertEquals(r[0], 1L << 60)
+		self.assertEquals(r[1], NO)
+
+
 	def testsignedlonglongAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testunsignedcharAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.unsignedcharArg_andboolArg_(0, YES)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedcharArg_andboolArg_(0, NO)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], NO)
+		r = o.unsignedcharArg_andboolArg_(128, YES)
+		self.assertEquals(r[0], 128)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedcharArg_andboolArg_(128, NO)
+		self.assertEquals(r[0], 128)
+		self.assertEquals(r[1], NO)
+		r = o.unsignedcharArg_andboolArg_(255, YES)
+		self.assertEquals(r[0], 255)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedcharArg_andboolArg_(255, NO)
+		self.assertEquals(r[0], 255)
+		self.assertEquals(r[1], NO)
+
+
 	def testunsignedcharAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testunsignedshortAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.unsignedshortArg_andboolArg_(0, YES)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedshortArg_andboolArg_(0, NO)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], NO)
+		r = o.unsignedshortArg_andboolArg_(42, YES)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedshortArg_andboolArg_(42, NO)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], NO)
+		r = o.unsignedshortArg_andboolArg_(1<<14, YES)
+		self.assertEquals(r[0], 1<<14)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedshortArg_andboolArg_(1<<14, NO)
+		self.assertEquals(r[0], 1<<14)
+		self.assertEquals(r[1], NO)
+
+
 	def testunsignedshortAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testunsignedintAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.unsignedintArg_andboolArg_(0, YES)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedintArg_andboolArg_(0, NO)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], NO)
+		r = o.unsignedintArg_andboolArg_(42, YES)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedintArg_andboolArg_(42, NO)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], NO)
+		r = o.unsignedintArg_andboolArg_(1 << 30, YES)
+		self.assertEquals(r[0], 1 << 30)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedintArg_andboolArg_(1 << 30, NO)
+		self.assertEquals(r[0], 1 << 30)
+		self.assertEquals(r[1], NO)
+
+
 	def testunsignedintAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testunsignedlongAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.unsignedlongArg_andboolArg_(0, YES)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedlongArg_andboolArg_(0, NO)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], NO)
+		r = o.unsignedlongArg_andboolArg_(42, YES)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedlongArg_andboolArg_(42, NO)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], NO)
+		r = o.unsignedlongArg_andboolArg_(1L << 30, YES)
+		self.assertEquals(r[0], 1L << 30)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedlongArg_andboolArg_(1L << 30, NO)
+		self.assertEquals(r[0], 1L << 30)
+		self.assertEquals(r[1], NO)
+
+
 	def testunsignedlongAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testunsignedlonglongAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.unsignedlonglongArg_andboolArg_(0, YES)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedlonglongArg_andboolArg_(0, NO)
+		self.assertEquals(r[0], 0)
+		self.assertEquals(r[1], NO)
+		r = o.unsignedlonglongArg_andboolArg_(42, YES)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedlonglongArg_andboolArg_(42, NO)
+		self.assertEquals(r[0], 42)
+		self.assertEquals(r[1], NO)
+		r = o.unsignedlonglongArg_andboolArg_(1L << 62, YES)
+		self.assertEquals(r[0], 1L << 62)
+		self.assertEquals(r[1], YES)
+		r = o.unsignedlonglongArg_andboolArg_(1L << 62, NO)
+		self.assertEquals(r[0], 1L << 62)
+		self.assertEquals(r[1], NO)
+
+
 	def testunsignedlonglongAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testfloatAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.floatArg_andboolArg_(0.128, YES)
+		self.assertAlmostEquals(r[0], 0.128)
+		self.assertEquals(r[1], YES)
+		r = o.floatArg_andboolArg_(0.128, NO)
+		self.assertAlmostEquals(r[0], 0.128)
+		self.assertEquals(r[1], NO)
+		r = o.floatArg_andboolArg_(1.0, YES)
+		self.assertAlmostEquals(r[0], 1.0)
+		self.assertEquals(r[1], YES)
+		r = o.floatArg_andboolArg_(1.0, NO)
+		self.assertAlmostEquals(r[0], 1.0)
+		self.assertEquals(r[1], NO)
+		r = o.floatArg_andboolArg_(42.0, YES)
+		self.assertAlmostEquals(r[0], 42.0)
+		self.assertEquals(r[1], YES)
+		r = o.floatArg_andboolArg_(42.0, NO)
+		self.assertAlmostEquals(r[0], 42.0)
+		self.assertEquals(r[1], NO)
+		r = o.floatArg_andboolArg_(1e10, YES)
+		self.assertAlmostEquals(r[0], 1e10)
+		self.assertEquals(r[1], YES)
+		r = o.floatArg_andboolArg_(1e10, NO)
+		self.assertAlmostEquals(r[0], 1e10)
+		self.assertEquals(r[1], NO)
+
+
 	def testfloatAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testdoubleAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.doubleArg_andboolArg_(0.128, YES)
+		self.assertAlmostEquals(r[0], 0.128)
+		self.assertEquals(r[1], YES)
+		r = o.doubleArg_andboolArg_(0.128, NO)
+		self.assertAlmostEquals(r[0], 0.128)
+		self.assertEquals(r[1], NO)
+		r = o.doubleArg_andboolArg_(1.0, YES)
+		self.assertAlmostEquals(r[0], 1.0)
+		self.assertEquals(r[1], YES)
+		r = o.doubleArg_andboolArg_(1.0, NO)
+		self.assertAlmostEquals(r[0], 1.0)
+		self.assertEquals(r[1], NO)
+		r = o.doubleArg_andboolArg_(42.0, YES)
+		self.assertAlmostEquals(r[0], 42.0)
+		self.assertEquals(r[1], YES)
+		r = o.doubleArg_andboolArg_(42.0, NO)
+		self.assertAlmostEquals(r[0], 42.0)
+		self.assertEquals(r[1], NO)
+		r = o.doubleArg_andboolArg_(1e10, YES)
+		self.assertAlmostEquals(r[0], 1e10)
+		self.assertEquals(r[1], YES)
+		r = o.doubleArg_andboolArg_(1e10, NO)
+		self.assertAlmostEquals(r[0], 1e10)
+		self.assertEquals(r[1], NO)
+
+
 	def testdoubleAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testidAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.idArg_andboolArg_(NSPriorDayDesignations, YES)
+		self.assertEquals(r[0], NSPriorDayDesignations)
+		self.assertEquals(r[1], YES)
+		r = o.idArg_andboolArg_(NSPriorDayDesignations, NO)
+		self.assertEquals(r[0], NSPriorDayDesignations)
+		self.assertEquals(r[1], NO)
+
+
 	def testidAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testcharPtrAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.charPtrArg_andboolArg_("hello", YES)
+		self.assertEquals(r[0], "hello")
+		self.assertEquals(r[1], YES)
+		r = o.charPtrArg_andboolArg_("hello", NO)
+		self.assertEquals(r[0], "hello")
+		self.assertEquals(r[1], NO)
+		r = o.charPtrArg_andboolArg_("world", YES)
+		self.assertEquals(r[0], "world")
+		self.assertEquals(r[1], YES)
+		r = o.charPtrArg_andboolArg_("world", NO)
+		self.assertEquals(r[0], "world")
+		self.assertEquals(r[1], NO)
+		r = o.charPtrArg_andboolArg_("foobar", YES)
+		self.assertEquals(r[0], "foobar")
+		self.assertEquals(r[1], YES)
+		r = o.charPtrArg_andboolArg_("foobar", NO)
+		self.assertEquals(r[0], "foobar")
+		self.assertEquals(r[1], NO)
+
+
 	def testcharPtrAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testNSPointAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.NSPointArg_andboolArg_((1, 2), YES)
+		self.assertEquals(r[0], (1, 2))
+		self.assertEquals(r[1], YES)
+		r = o.NSPointArg_andboolArg_((1, 2), NO)
+		self.assertEquals(r[0], (1, 2))
+		self.assertEquals(r[1], NO)
+		r = o.NSPointArg_andboolArg_((3, 4), YES)
+		self.assertEquals(r[0], (3, 4))
+		self.assertEquals(r[1], YES)
+		r = o.NSPointArg_andboolArg_((3, 4), NO)
+		self.assertEquals(r[0], (3, 4))
+		self.assertEquals(r[1], NO)
+
+
 	def testNSPointAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def testNSRectAndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.NSRectArg_andboolArg_(((1, 2), (3, 4)), YES)
+		self.assertEquals(r[0], ((1, 2), (3, 4)))
+		self.assertEquals(r[1], YES)
+		r = o.NSRectArg_andboolArg_(((1, 2), (3, 4)), NO)
+		self.assertEquals(r[0], ((1, 2), (3, 4)))
+		self.assertEquals(r[1], NO)
+		r = o.NSRectArg_andboolArg_(((7, 8), (9, 10)), YES)
+		self.assertEquals(r[0], ((7, 8), (9, 10)))
+		self.assertEquals(r[1], YES)
+		r = o.NSRectArg_andboolArg_(((7, 8), (9, 10)), NO)
+		self.assertEquals(r[0], ((7, 8), (9, 10)))
+		self.assertEquals(r[1], NO)
+
+
 	def testNSRectAndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def teststructTestStruct1AndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.structTestStruct1Arg_andboolArg_((1, 2, (1, 2, 3, 4, 5)), YES)
+		self.assertEquals(r[0], (1, 2, (1, 2, 3, 4, 5)))
+		self.assertEquals(r[1], YES)
+		r = o.structTestStruct1Arg_andboolArg_((1, 2, (1, 2, 3, 4, 5)), NO)
+		self.assertEquals(r[0], (1, 2, (1, 2, 3, 4, 5)))
+		self.assertEquals(r[1], NO)
+		r = o.structTestStruct1Arg_andboolArg_((9, 8, (-1, -2, -3, -4, -5)), YES)
+		self.assertEquals(r[0], (9, 8, (-1, -2, -3, -4, -5)))
+		self.assertEquals(r[1], YES)
+		r = o.structTestStruct1Arg_andboolArg_((9, 8, (-1, -2, -3, -4, -5)), NO)
+		self.assertEquals(r[0], (9, 8, (-1, -2, -3, -4, -5)))
+		self.assertEquals(r[1], NO)
+
+
 	def teststructTestStruct1AndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def teststructTestStruct2AndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.structTestStruct2Arg_andboolArg_((1, 2, (1, 2, 3, 4, 5)), YES)
+		self.assertEquals(r[0], (1, 2, (1, 2, 3, 4, 5)))
+		self.assertEquals(r[1], YES)
+		r = o.structTestStruct2Arg_andboolArg_((1, 2, (1, 2, 3, 4, 5)), NO)
+		self.assertEquals(r[0], (1, 2, (1, 2, 3, 4, 5)))
+		self.assertEquals(r[1], NO)
+		r = o.structTestStruct2Arg_andboolArg_((9, 8, (-1, -2, -3, -4, -5)), YES)
+		self.assertEquals(r[0], (9, 8, (-1, -2, -3, -4, -5)))
+		self.assertEquals(r[1], YES)
+		r = o.structTestStruct2Arg_andboolArg_((9, 8, (-1, -2, -3, -4, -5)), NO)
+		self.assertEquals(r[0], (9, 8, (-1, -2, -3, -4, -5)))
+		self.assertEquals(r[1], NO)
+
+
 	def teststructTestStruct2AndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 		self.assertEquals(r[1], (2, 4))
 
 
+	def teststructTestStruct3AndboolArg(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.structTestStruct3Arg_andboolArg_((1, 2), YES)
+		self.assertEquals(r[0], (1, 2))
+		self.assertEquals(r[1], YES)
+		r = o.structTestStruct3Arg_andboolArg_((1, 2), NO)
+		self.assertEquals(r[0], (1, 2))
+		self.assertEquals(r[1], NO)
+		r = o.structTestStruct3Arg_andboolArg_((2, 4), YES)
+		self.assertEquals(r[0], (2, 4))
+		self.assertEquals(r[1], YES)
+		r = o.structTestStruct3Arg_andboolArg_((2, 4), NO)
+		self.assertEquals(r[0], (2, 4))
+		self.assertEquals(r[1], NO)
+
+
 	def teststructTestStruct3AndBOOLArg(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 
 	# Pass by reference arguments (in)
 
+	def testboolIn(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		r = o.boolInArg_(YES)
+		self.assertEquals(r, YES)
+		r = o.boolInArg_(NO)
+		self.assertEquals(r, NO)
+
+
 	def testBOOLIn(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 
 	# Pass by reference arguments (out)
 
+	def testboolOut(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		o.reset()
+		r = o.boolOutArg_()
+		self.assertEquals(r, YES)
+		r = o.boolOutArg_()
+		self.assertEquals(r, NO)
+
+
 	def testBOOLOut(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 
 	# Pass by reference arguments (inout)
 
+	def testboolInOut(self):
+		if not HAVE_BOOL: return
+		o = PyObjC_TestClass1.alloc().init()
+		self.assert_(o is not None)
+		o.reset()
+		r = o.boolInOutArg_(NO)
+		self.assertEquals(r[0], NO)
+		self.assertEquals(r[1], YES)
+		r = o.boolInOutArg_(YES)
+		self.assertEquals(r[0], YES)
+		self.assertEquals(r[1], NO)
+
+
 	def testBOOLInOut(self):
 		o = PyObjC_TestClass1.alloc().init()
 		self.assert_(o is not None)
 
 
 # Helper arrays
+g_bool_values = (YES, NO)
 g_BOOL_values = (YES, NO)
 g_char_values = (-128, 0, 127)
 g_signedshort_values = (-(1<<14), -42, 0, 42, 1 << 14)
 		self.counter = 0
 
 
+	if HAVE_BOOL:
+		def boolMethod(self):
+			if self.counter > 2: self.reset()
+			idx = self.counter
+			self.counter += 1
+			return g_bool_values[idx]
+		boolMethod = objc.selector(boolMethod, signature="B@:")
+
+
 	def BOOLMethod(self):
 		if self.counter > 2: self.reset()
 		idx = self.counter
 		self.counter += 1
 		return g_BOOL_values[idx]
-	BOOLMethod = objc.selector(BOOLMethod, signature="C@:")
+	BOOLMethod = objc.selector(BOOLMethod, signature="c@:")
 
 
 	def charMethod(self):
 	structTestStruct3Method = objc.selector(structTestStruct3Method, signature="{_TestStruct3=ci}@:")
 
 
+	if HAVE_BOOL:
+		def boolArg_(self, arg):
+			return arg # return the same
+		boolArg_ = objc.selector(boolArg_, signature="@@:B")
+
+
 	def BOOLArg_(self, arg):
 		return arg # return the same
-	BOOLArg_ = objc.selector(BOOLArg_, signature="@@:C")
+	BOOLArg_ = objc.selector(BOOLArg_, signature="@@:c")
 
 
 	def charArg_(self, arg):
 	structTestStruct3Arg_ = objc.selector(structTestStruct3Arg_, signature="@@:{_TestStruct3=ci}")
 
 
+	if HAVE_BOOL:
+		def boolArg_andboolArg_(self, arg1, arg2):
+			return [ arg1, arg2 ]
+		boolArg_andboolArg_ = objc.selector(boolArg_andboolArg_, signature="@@:BB")
+
+
+	if HAVE_BOOL:
+		def boolArg_andBOOLArg_(self, arg1, arg2):
+			return [ arg1, arg2 ]
+		boolArg_andBOOLArg_ = objc.selector(boolArg_andBOOLArg_, signature="@@:Bc")
+
+
+	if HAVE_BOOL:
+		def boolArg_andcharArg_(self, arg1, arg2):
+			return [ arg1, arg2 ]
+		boolArg_andcharArg_ = objc.selector(boolArg_andcharArg_, signature="@@:Bc")
+
+
+	if HAVE_BOOL:
+		def boolArg_andsignedshortArg_(self, arg1, arg2):
+			return [ arg1, arg2 ]
+		boolArg_andsignedshortArg_ = objc.selector(boolArg_andsignedshortArg_, signature="@@:Bs")
+
+
+	if HAVE_BOOL:
+		def boolArg_andsignedintArg_(self, arg1, arg2):
+			return [ arg1, arg2 ]
+		boolArg_andsignedintArg_ = objc.selector(boolArg_andsignedintArg_, signature="@@:Bi")
+
+
+	if HAVE_BOOL: