Exemplo n.º 1
0
	def test_header_parser(self):
		
		# test enumeration parsing
		# has multiple enums, and multiple variants:
		# enum Type 
		# { 
		#	kInvalid = 0,  ... }
		# and without intitialization
		viewheader= mdb.headerPath('M3dView')
		enums, = mdb.CppHeaderParser.parseAndExtract(viewheader)
		assert len(enums) > 7		# could change with maya versions, 7 should be minimum
		
		for ed in enums:
			assert isinstance(ed, mdb.MEnumDescriptor)
			assert len(ed)
			assert isinstance(ed.name, basestring)
			
			# convert to MEnumeration
			enum = MEnumeration.create(ed, apiui.M3dView)
			assert isinstance(enum, MEnumeration)
			assert enum.name == ed.name
			assert len(enum) == len(ed)
			for em in ed:
				ev = getattr(enum, em)
				assert isinstance(ev, int)
				assert enum.nameByValue(ev) == em
			# END check each instance
			self.failUnlessRaises(ValueError, enum.nameByValue, -1)
Exemplo n.º 2
0
	def test_header_parser(self):
		# brutally work through all headers - we shouldn't fail at least
		base = mdb.headerPath('MFn').parent()
		headers = sorted(base.files(pattern="*.h"))
		nh = len(headers)
		parser = mdb.CppHeaderParser()
		
		st = time.time()
		for hfile in headers:
			parser.parseAndExtract(hfile)
		# END for each file
		elapsed = time.time() - st
		
		print >> sys.stderr, "Parsed %i header files in %f s ( %f headers / s)" % ( nh, elapsed, nh/elapsed )
Exemplo n.º 3
0
    def test_header_parser(self):
        # brutally work through all headers - we shouldn't fail at least
        base = mdb.headerPath('MFn').parent()
        headers = sorted(base.files(pattern="*.h"))
        nh = len(headers)
        parser = mdb.CppHeaderParser()

        st = time.time()
        for hfile in headers:
            parser.parseAndExtract(hfile)
        # END for each file
        elapsed = time.time() - st

        print >> sys.stderr, "Parsed %i header files in %f s ( %f headers / s)" % (
            nh, elapsed, nh / elapsed)