def test_single_and_should_match_solo(self):
        expected_result = bytearray.fromhex(
            "3F44FB41486D4A36A8ADCA2203E73A5068BFED5FDCE5092B9A3C6CCE8ABF3B0C")

        test1 = t2pc.PolicyTreeSolo(
            t2pc.PolicyCommandCode("TPM_CC_ClearControl"))
        test2 = t2pc.PolicyTreeSolo(t2pc.PolicyCommandCode("TPM_CC_Clear"))
        orTest = t2pc.PolicyTreeOr([test1, test2])

        phash = t2pc.PolicyHasher('sha256')
        self.assertEqual(orTest.get_policy(phash), expected_result)
    def test_policy_locality(self):
        expected_result = bytearray.fromhex(
            "07039B45BAF2CC169B0D84AF7C53FD1622B033DF0A5DCDA66360AA99E54947CD")

        test = t2pc.PolicyTreeSolo(t2pc.PolicyLocality([3, 4]))

        phash = t2pc.PolicyHasher('sha256')
        self.assertEqual(test.get_policy(phash), expected_result)
    def test_policy_command_code(self):
        expected_result_1 = bytearray.fromhex(
            "940CFB4217BB1EDCF7FB41937CA974AA68E698AB78B8124B070113E211FD46FC")
        expected_result_2 = bytearray.fromhex(
            "C4DFABCEDA8DE836C95661952892B1DEF7203AFB46FEFEC43FFCFC93BE540730")
        expected_result_3 = bytearray.fromhex(
            "1D2DC485E177DDD0A40A344913CEEB420CAA093C42587D2E1B132B157CCB5DB0")

        test1 = t2pc.PolicyTreeSolo(
            t2pc.PolicyCommandCode("TPM_CC_ClearControl"))
        test2 = t2pc.PolicyTreeSolo(t2pc.PolicyCommandCode("TPM_CC_Clear"))
        test3 = t2pc.PolicyTreeSolo(
            t2pc.PolicyCommandCode("TPM_CC_NV_UndefineSpaceSpecial"))

        phash = t2pc.PolicyHasher('sha256')
        self.assertEqual(test1.get_policy(phash), expected_result_1)
        self.assertEqual(test2.get_policy(phash), expected_result_2)
        self.assertEqual(test3.get_policy(phash), expected_result_3)
    def test_single_and_should_match_solo(self):
        soloTest = t2pc.PolicyTreeSolo(t2pc.PolicyCommandCode("TPM_CC_Clear"))
        andTest = t2pc.PolicyTreeAnd([t2pc.PolicyCommandCode("TPM_CC_Clear")])

        phash = t2pc.PolicyHasher('sha256')
        self.assertEqual(soloTest.get_policy(phash), andTest.get_policy(phash))