def test_merge_with_add(): c1 = CRN() c1.r("A + B <> 2C", [1, 1]) c1['A'] = 2 c2 = copy(c1) c2['A'] = 4 c2['B'] = 1 assert(c1['A'] == 2) assert(c1['B'] == 0) assert(c1['C'] == 0) print(c1.x) c1.merge(c2, lambda a, b: a+b) assert(c1['A'] == 6) assert(c1['B'] == 1) assert(c1['C'] == 0)
def test_merge_with_add(): c1 = CRN() c1.r("A + B <> 2C", [1, 1]) c1['A'] = 2 c2 = copy(c1) c2['A'] = 4 c2['B'] = 1 assert (c1['A'] == 2) assert (c1['B'] == 0) assert (c1['C'] == 0) print(c1.x) c1.merge(c2, lambda a, b: a + b) assert (c1['A'] == 6) assert (c1['B'] == 1) assert (c1['C'] == 0)
def test_merge(): c1 = CRN() c1.r("A + B <> 2C", [1, 1]) c1['A'] = 2 c2 = copy(c1) c2['A'] = 4 c2['B'] = 1 assert(c1['A'] == 2) assert(c1['B'] == 0) assert(c1['C'] == 0) c1.merge(c2) assert(c1['A'] == 4) assert(c1['B'] == 1) assert(c1['C'] == 0)
def test_merge(): c1 = CRN() c1.r("A + B <> 2C", [1, 1]) c1['A'] = 2 c2 = copy(c1) c2['A'] = 4 c2['B'] = 1 assert (c1['A'] == 2) assert (c1['B'] == 0) assert (c1['C'] == 0) c1.merge(c2) assert (c1['A'] == 4) assert (c1['B'] == 1) assert (c1['C'] == 0)