コード例 #1
0
ファイル: testSymbols.py プロジェクト: schwidom/pl-lisp
def testSymbols3():

 te.checkComplainAndAdjustExpected( 0)

 s1= Symbol( 's1')
 s2= Symbol( 's2')
 s3= Symbol( 's3')
 s4= Symbol( 's4')
 s5= Symbol( 's5')

 typeSymbol.symAdd( s2, [s1])
 typeSymbol.symAdd( s3, [s2])
 typeSymbol.symAdd( s4, [s3])
 typeSymbol.symAdd( s5, [s4])

 te.test( typeSymbolChk( s5, s1))

 typeSymbolNot.symAdd( s4, [s2])

 te.test( not typeSymbolChk( s5, s1))
 te.test( not typeSymbolChk( s5, s2))
 te.test( typeSymbolChk( s5, s3))
 te.test( typeSymbolChk( s5, s4))

 te.test( not typeSymbolChk( s4, s1))
 te.test( not typeSymbolChk( s4, s2))
 te.test( typeSymbolChk( s4, s3))

 te.test( typeSymbolChk( s3, s1))
 te.test( typeSymbolChk( s3, s2))

 te.test( typeSymbolChk( s2, s1))

 typeSymbol.symDel( s5)
 typeSymbol.symDel( s4)
 typeSymbol.symDel( s3)
 typeSymbol.symDel( s2)

 typeSymbolNot.symDel( s4)

 te.checkComplainAndAdjustExpected( 11)
コード例 #2
0
ファイル: ConsTrait.py プロジェクト: schwidom/pl-lisp
                assert id(consHistory) == id(consWrappedCar.car())
                consWrappedCar.cdr(ConsHistory(self.cf.unpack(value), consWrappedCar.cdr()))

        def cdr(self, value=None):
            return self.cf.pack(self.consWrapped.cdr(self.cf.unpack(value)))

    ConsAbstractCarAutoHistory.cf = ConsAbstractClassFunctions(
        ConsAbstractCarAutoHistory, ConsWrapped
    )  # 1 mal pro Klasse ist Korrekt, auch mit der neuen hashtable, die das Vorhandensein der jeweiligen ConsAbstract (im moment noch ConsAbstractCarAutoHistory ) prueft

    ConsAbstractCarAutoHistory.__name__ += " " + str(id(ConsAbstractCarAutoHistory))
    return ConsAbstractCarAutoHistory


ar_assoc = Symbol("ar_assoc")
typeSymbol.symAdd(ar_assoc, [ar_list])

ar_assocElem = Symbol("ar_assocElem")
typeSymbol.symAdd(ar_assocElem, [ar_list])

not_found = Symbol("not_found")


def consesMake(*l):
    if 0 == len(l):
        return nil
    else:
        ret = ConsSimple(l[0], nil)
        current = ret
        for i in l[1:]:
            current.cdr(ConsSimple(nil, nil))
コード例 #3
0
from symbols import Symbol, typeSymbol, ar_list, doSubConsType
from ConsTrait import ar_assoc, assocMake, assocAdd, consesMake
from symbols import ensureConsType
from ConsTrait import assocGet, listLen, consesNth0, assocNth0, assocClone
from ConsTrait import Cons, ConsRepr
from symbols import ar_value

ar_codeList = Symbol("ar_codeList")
typeSymbol.symAdd(ar_codeList, [ar_list])

ar_codeListConfig = Symbol("ar_codeListConfig")
typeSymbol.symAdd(ar_codeListConfig, [ar_assoc])

ar_codeListParameters = Symbol("ar_codeListParameters")
typeSymbol.symAdd(ar_codeListParameters, [ar_list])

ar_retList = Symbol("ar_retList")
typeSymbol.symAdd(ar_retList, [ar_list])

ar_retValue = Symbol("ar_retValue")
typeSymbol.symAdd(ar_retValue, [ar_value])

ar_retValueFromMacro = Symbol("ar_retValueFromMacro")
typeSymbol.symAdd(ar_retValueFromMacro, [ar_value])

ar_stack = Symbol("ar_stack")
typeSymbol.symAdd(ar_stack, [ar_list])

s_environment = Symbol("s_environment")
s_macroLevel = Symbol("s_macroLevel")
s_environment_quotationMode = Symbol("s_environment_quotationMode")
コード例 #4
0
ファイル: testSymbols.py プロジェクト: schwidom/pl-lisp
def testSymbols1(): # 010407a6a37b49bfb9836e84236e5586
 
 te.checkComplainAndAdjustExpected( 0)

 s1= Symbol( 's1')
 s2= Symbol( 's2')
 s3= Symbol( 's3')
 s4= Symbol( 's4')

 te.test( not typeSymbolChk( s4, Symbol( 's4')))

 te.test( typeSymbolChk( s4, s4)) 
 te.test( typeSymbolChk( s1, s1))

 typeSymbol.symAdd( s2, [s1])
 typeSymbol.symAdd( s3, [s1])
 typeSymbol.symAdd( s4, [s2, s3])

 te.test( typeSymbolChk( s4, s3))
 te.test( typeSymbolChk( s4, s2))
 te.test( typeSymbolChk( s4, s1))
 te.test( typeSymbolChk( s3, s1))
 te.test( typeSymbolChk( s2, s1))

 typeSymbolNot.symAdd( s3, [s1])

 te.test( typeSymbolChk( s4, s3))
 te.test( typeSymbolChk( s4, s2))
 te.test( typeSymbolChk( s4, s1))
 te.test( not typeSymbolChk( s3, s1))
 te.test( typeSymbolChk( s2, s1))
 
 typeSymbolNot.symAdd( s2, [s1])

 te.test( typeSymbolChk( s4, s3))
 te.test( typeSymbolChk( s4, s2))
 te.test( not typeSymbolChk( s4, s1))
 te.test( not typeSymbolChk( s3, s1))
 te.test( not typeSymbolChk( s2, s1))
 
 typeSymbolNot.symAdd( s4, [s3,s2])

 te.test( not typeSymbolChk( s4, s3))
 te.test( not typeSymbolChk( s4, s2))
 te.test( not typeSymbolChk( s4, s1))
 te.test( not typeSymbolChk( s3, s1))
 te.test( not typeSymbolChk( s2, s1))

 typeSymbolNot.symDel( s3)

 te.test( not typeSymbolChk( s4, s3))
 te.test( not typeSymbolChk( s4, s2))
 te.test( not typeSymbolChk( s4, s1))
 te.test( typeSymbolChk( s3, s1))
 te.test( not typeSymbolChk( s2, s1))

 typeSymbolNot.symDel( s2)

 te.test( not typeSymbolChk( s4, s3))
 te.test( not typeSymbolChk( s4, s2))
 te.test( not typeSymbolChk( s4, s1))
 te.test( typeSymbolChk( s3, s1))
 te.test( typeSymbolChk( s2, s1))
 
 typeSymbolNot.symDel( s4)
 for i in ( s4, s3, s2):
  typeSymbol.symDel( i)


 te.checkComplainAndAdjustExpected( 33)