How to use assertSetEqual method in autotest

Best Python code snippet using autotest_python

piecetest.py

Source:piecetest.py Github

copy

Full Screen

...21 pawn = Pawn(x, y, Piece.white, state)22 pawn.idle = False23 actual = set(pawn.get_movable())24 expected = {(3, 5)}25 self.assertSetEqual(actual, expected)26 pawn.color = Piece.black27 actual = set(pawn.get_movable())28 expected = {(3, 7)}29 self.assertSetEqual(actual, expected)30 31 """32 +-33 |P34 """35 x, y = 0, 036 pawn = Pawn(x, y, Piece.white, state)37 pawn.idle = False38 actual = set(pawn.get_movable())39 expected = set()40 self.assertSetEqual(actual, expected)41 pawn.color = Piece.black42 actual = set(pawn.get_movable())43 expected = {(0, 1)}44 self.assertSetEqual(actual, expected)45 """46 -+47 B|48 P|49 """50 x, y = 7, 151 block_x, block_y = 7, 052 pawn = Pawn(x, y, Piece.white, state)53 pawn.idle = False54 blocker = Pawn(block_x, block_y, Piece.black, state)55 actual = set(pawn.get_movable())56 expected = set()57 self.assertSetEqual(actual, expected)58 def test_pawn_idle_movable(self):59 state = GameState()60 61 """62 O63 O 64 P65 """66 x, y = 3, 667 pawn = Pawn(x, y, Piece.white, state)68 actual = set(pawn.get_movable())69 expected = {(3, 5), (3, 4)}70 self.assertSetEqual(actual, expected)71 72 pawn.color = Piece.black73 actual = set(pawn.get_movable())74 expected = {(3, 7)}75 self.assertSetEqual(actual, expected)76 pawn.color = Piece.white77 78 """79 B80 O81 P82 """83 block_x, block_y = 3, 484 blocker_a = Pawn(block_x, block_y, Piece.white, state)85 actual = set(pawn.get_movable())86 expected = {(3, 5)}87 self.assertSetEqual(actual, expected)88 """89 B90 B91 P92 """93 block_x, block_y = 3, 594 blocker_b = Pawn(block_x, block_y, Piece.white, state)95 actual = set(pawn.get_movable())96 expected = set()97 self.assertSetEqual(actual, expected)98 99 """100 B101 P102 """103 state.board[3][4] = None104 expected = set(pawn.get_movable())105 actual = set()106 self.assertSetEqual(actual, expected)107 """108 +-109 |O110 |P111 """112 x, y = 0, 1113 pawn = Pawn(x, y, Piece.white, state)114 actual = set(pawn.get_movable())115 expected = {(0, 0)}116 self.assertSetEqual(actual, expected)117 """118 -+119 P|120 """121 x, y = 7, 0122 pawn = Pawn(x, y, Piece.white, state)123 actual = set(pawn.get_movable())124 expected = set()125 self.assertSetEqual(actual, expected)126 def test_pawn_target_movable(self):127 state = GameState()128 """129 O130 OT131 P132 """133 pa_x, pa_y = 3, 6134 ta_x, ta_y = 4, 5135 pawn_a = Pawn(pa_x, pa_y, Piece.white, state)136 target_a = Pawn(ta_x, ta_y, Piece.black, state)137 actual = set(pawn_a.get_movable())138 expected = {(3, 5), (4, 5), (3, 4)}139 self.assertSetEqual(actual, expected)140 """141 OT142 P143 """144 pawn_a.idle = False145 actual = set(pawn_a.get_movable())146 expected = {(3, 5), (4, 5)}147 self.assertSetEqual(actual, expected)148 """149 --+150 TO|151 P|152 """153 pb_x, pb_y = 7, 1154 tb_x, tb_y = 6, 0155 pawn_b = Pawn(pb_x, pb_y, Piece.white, state)156 target_b = Pawn(tb_x, tb_y, Piece.black, state)157 actual = set(pawn_b.get_movable())158 expected = {(6, 0), (7, 0)}159 self.assertSetEqual(actual, expected)160 def test_pawn_promotion(self):161 state = GameState()162 x, y = 0, 2163 piece = Pawn(x, y, Piece.white, state)164 piece.idle = False165 actual = piece.is_promoted()166 self.assertFalse(actual)167 source = (x, y)168 target = (x, y - 1)169 state.make_move(source, target)170 actual = piece.is_promoted()171 self.assertFalse(actual)172 source = (x, y - 1)173 target = (x, y - 2)174 state.make_move(source, target)175 actual = piece.is_promoted()176 self.assertTrue(actual)177 x, y = 3, 6178 piece = Pawn(x, y, Piece.black, state)179 piece.idle = False180 actual = piece.is_promoted()181 self.assertFalse(actual)182 source = (x, y)183 target = (x, y + 1)184 state.make_move(source, target)185 actual = piece.is_promoted()186 self.assertTrue(actual)187 188 def test_pawn_enpassant_movable(self):189 state = GameState()190 x, y = 3, 6191 pawn = Pawn(x, y, Piece.white, state)192 target_a = Pawn(x - 1, y, Piece.black, state)193 pawn.idle = False194 target_a.idle = False195 target_a.after_first_move = True196 actual = set(pawn.get_movable())197 expected = {(3, 5), (2, 5)}198 self.assertSetEqual(actual, expected)199 target_b = Pawn(x + 1, y, Piece.black, state)200 target_b.idle = False201 target_b.after_first_move = False202 actual = set(pawn.get_movable())203 expected = {(3, 5), (2, 5)}204 self.assertSetEqual(actual, expected)205 def test_rook_movable(self):206 state = GameState()207 x, y = 3, 6208 rook = Rook(x, y, Piece.white, state)209 actual = set(rook.get_movable())210 expected = {(4, 6), (5, 6), (6, 6), (7, 6),211 (2, 6), (1, 6), (0, 6),212 (3, 7),213 (3, 5), (3, 4), (3, 3), (3, 2), (3, 1), (3, 0)}214 self.assertSetEqual(actual, expected)215 blocker_a = Pawn(3, 7, Piece.white, state)216 blocker_b = Pawn(1, 6, Piece.white, state)217 actual = set(rook.get_movable())218 expected = {(4, 6), (5, 6), (6, 6), (7, 6),219 (2, 6),220 (3, 5), (3, 4), (3, 3), (3, 2), (3, 1), (3, 0)}221 self.assertSetEqual(actual, expected)222 def test_rook_target_movable(self):223 state = GameState()224 x, y = 3, 6225 rook = Rook(x, y, Piece.white, state)226 227 target_a = Pawn(3, 3, Piece.black, state)228 target_b = Pawn(4, 6, Piece.black, state)229 actual = set(rook.get_movable())230 expected = {(4, 6),231 (2, 6), (1, 6), (0, 6),232 (3, 7),233 (3, 5), (3, 4), (3, 3)}234 self.assertSetEqual(actual, expected)235 def test_knight_movable(self):236 state = GameState()237 x, y = 3, 6238 knight = Knight(x, y, Piece.white, state)239 actual = set(knight.get_movable())240 expected = {(4, 4), (5, 5), (5, 7), (1, 7), (1, 5), (2, 4)}241 self.assertSetEqual(actual, expected)242 blocker_a = Pawn(5, 5, Piece.white, state)243 blocker_b = Pawn(2, 4, Piece.white, state)244 actual = set(knight.get_movable())245 expected = {(4, 4), (5, 7), (1, 7), (1, 5)}246 self.assertSetEqual(actual, expected)247 def test_knight_target_movable(self):248 state = GameState()249 x, y = 3, 6250 knight = Knight(x, y, Piece.white, state)251 target = Pawn(4, 4, Piece.black, state)252 actual = set(knight.get_movable())253 expected = {(4, 4), (5, 5), (5, 7), (1, 7), (1, 5), (2, 4)}254 self.assertSetEqual(actual, expected)255 256 def test_bishop_movable(self):257 state = GameState()258 x, y = 3, 6259 bishop = Bishop(x, y, Piece.white, state)260 actual = set(bishop.get_movable())261 expected = {(4, 5), (5, 4), (6, 3), (7, 2),262 (4, 7),263 (2, 7),264 (2, 5), (1, 4), (0, 3)}265 self.assertSetEqual(actual, expected)266 blocker_a = Pawn(6, 3, Piece.white, state)267 blocker_b = Pawn(2, 5, Piece.white, state)268 actual = set(bishop.get_movable())269 expected = {(4, 5), (5, 4),270 (4, 7),271 (2, 7)}272 self.assertSetEqual(actual, expected)273 def test_bishop_target_movable(self):274 state = GameState()275 x, y = 3, 6276 bishop = Bishop(x, y, Piece.white, state)277 target_a = Pawn(5, 4, Piece.black, state)278 target_b = Pawn(2, 7, Piece.black, state)279 actual = set(bishop.get_movable())280 expected = {(4, 5), (5, 4),281 (4, 7),282 (2, 7),283 (2, 5), (1, 4), (0, 3)}284 self.assertSetEqual(actual, expected)285 286 def test_queen_movable(self):287 state = GameState()288 x, y = 3, 6289 queen = Queen(x, y, Piece.white, state)290 actual = set(queen.get_movable())291 expected = {(3, 5), (3, 4), (3, 3), (3, 2), (3, 1), (3, 0),292 (4, 5), (5, 4), (6, 3), (7, 2),293 (4, 6), (5, 6), (6, 6), (7, 6),294 (4, 7),295 (3, 7),296 (2, 7),297 (2, 6), (1, 6), (0, 6),298 (2, 5), (1, 4), (0, 3)}299 self.assertSetEqual(actual, expected)300 blocker_a = Pawn(3, 0, Piece.white, state)301 blocker_b = Pawn(4, 5, Piece.white, state)302 blocker_b = Pawn(6, 6, Piece.white, state)303 blocker_d = Pawn(2, 7, Piece.white, state)304 actual = set(queen.get_movable())305 expected = {(3, 5), (3, 4), (3, 3), (3, 2), (3, 1),306 (4, 6), (5, 6),307 (4, 7),308 (3, 7),309 (2, 6), (1, 6), (0, 6),310 (2, 5), (1, 4), (0, 3)}311 self.assertSetEqual(actual, expected)312 def test_queen_target_movable(self):313 state = GameState()314 x, y = 3, 6315 queen = Queen(3, 6, Piece.white, state)316 target_a = Pawn(3, 5, Piece.black, state)317 target_b = Pawn(4, 7, Piece.black, state)318 target_c = Pawn(1, 6, Piece.black, state)319 actual = set(queen.get_movable())320 expected = {(3, 5),321 (4, 5), (5, 4), (6, 3), (7, 2),322 (4, 6), (5, 6), (6, 6), (7, 6),323 (3, 7),324 (4, 7),325 (2, 7),326 (2, 6), (1, 6),327 (2, 5), (1, 4), (0, 3)}328 self.assertSetEqual(actual, expected)329 330 def test_king_movable(self):331 state = GameState()332 x, y = 3, 6333 king = King(x, y, Piece.white, state)334 actual = set(king.get_movable())335 expected = {(2, 5), (3, 5), (4, 5), (2, 6),336 (4, 6), (2, 7), (3, 7), (4, 7)}337 338 self.assertSetEqual(actual, expected)339 x, y = 7, 0340 king = King(x, y, Piece.white, state)341 342 blocker = Pawn(6, 1, Piece.white, state)343 actual = set(king.get_movable())344 expected = {(6, 0), (7, 1)}345 self.assertSetEqual(actual, expected)346 def test_king_target_movable(self):347 state = GameState()348 x, y = 3, 6349 king = King(x, y, Piece.white, state)350 target = Pawn(3, 7, Piece.black, state)351 blocker = Pawn(4, 7, Piece.white, state)352 actual = set(king.get_movable())353 expected = {(2, 5), (3, 5), (4, 5), (2, 6),354 (4, 6), (2, 7), (3, 7)}355 356 self.assertSetEqual(actual, expected)357 def test_check(self):358 state = GameState()359 x, y = 3, 6360 white_king = King(x, y, Piece.white, state)361 black_pawn = Pawn(x - 1, y - 1, Piece.black, state)362 actual = state.is_checked(state.board, 0)363 self.assertTrue(actual)364 365 actual = state.is_checked(state.board, 1)366 self.assertFalse(actual)367 state.board[x - 1][y - 1] = None368 black_pawn = Pawn(x - 1, y - 2, Piece.black, state)369 actual = state.is_checked(state.board, 0)370 self.assertFalse(actual)371 actual = state.is_checked(state.board, 1)372 self.assertFalse(actual)373 state.board[x - 1][y - 2] = None374 black_rook = Rook(x, y - 1, Piece.black, state)375 actual = state.is_checked(state.board, 0)376 self.assertTrue(actual)377 actual = set(white_king.get_movable())378 expected = {(3, 5),379 (2, 6), (4, 6),380 (2, 7), (4, 7)}381 self.assertSetEqual(actual, expected)382 def test_check_king_block(self):383 state = GameState()384 x, y = 3, 6385 white_king = King(x, y, Piece.white, state)386 black_pawn = Pawn(x, y - 2, Piece.black, state)387 black_pawn.idle = False388 actual = set(white_king.get_movable())389 expected = {(3, 5),390 (2, 6), (4, 6),391 (2, 7), (3, 7), (4, 7)}392 self.assertSetEqual(actual, expected)393 394 actual = state.is_checked(state.board, 0)395 self.assertFalse(actual)396 actual = state.is_checked(state.board, 1)397 self.assertFalse(actual)398 def test_check_move_block(self):399 state = GameState()400 x, y = 3, 6401 white_king = King(x, y, Piece.white, state)402 white_rook = Rook(x, y - 2, Piece.white, state)403 actual = set(white_king.get_movable())404 expected = {(2, 5), (3, 5), (4, 5),405 (2, 6), (4, 6),406 (2, 7), (3, 7), (4, 7)}407 self.assertSetEqual(actual, expected)408 actual = set(white_rook.get_movable())409 expected = {(3, 3), (3, 2), (3, 1), (3, 0), 410 (4, 4), (5, 4), (6, 4), (7, 4),411 (3, 5),412 (2, 4), (1, 4), (0, 4)}413 self.assertSetEqual(actual, expected)414 actual = state.is_checked(state.board, 0)415 self.assertFalse(actual)416 417 black_rook = Rook(x, y - 4, Piece.black, state)418 actual = set(white_king.get_movable())419 expected = {(2, 5), (3, 5), (4, 5),420 (2, 6), (4, 6),421 (2, 7), (3, 7), (4, 7)}422 self.assertSetEqual(actual, expected) 423 actual = set(white_rook.get_movable())424 expected = {(3, 3), (3, 2), 425 (3, 5)}426 self.assertSetEqual(actual, expected)427 actual = state.is_checked(state.board, 0)428 self.assertFalse(actual)429 black_queen = Queen(x - 1, y - 4, Piece.black, state)430 actual = set(white_king.get_movable())431 expected = {(3, 5), (4, 5),432 (4, 6),433 (3, 7), (4, 7)}434 self.assertSetEqual(actual, expected) 435 actual = set(white_rook.get_movable())436 expected = {(3, 3), (3, 2), 437 (3, 5)}438 self.assertSetEqual(actual, expected)439 actual = state.is_checked(state.board, 0)440 self.assertFalse(actual)441if __name__ == '__main__':...

Full Screen

Full Screen

test_slr_parser.py

Source:test_slr_parser.py Github

copy

Full Screen

...4344 with self.subTest(grammar_str=grammar_strs[0]):45 G = Grammar(grammar_strs[0])46 first, follow = first_follow(G)47 self.assertSetEqual({'(', 'id'}, first['E'])48 self.assertSetEqual({'(', 'id'}, first['T'])49 self.assertSetEqual({'(', 'id'}, first['F'])50 self.assertSetEqual({'$', '+', ')'}, follow['E'])51 self.assertSetEqual({'$', '+', '*', ')'}, follow['T'])52 self.assertSetEqual({'$', '+', '*', ')'}, follow['F'])5354 with self.subTest(grammar_str=grammar_strs[1]):55 G = Grammar(grammar_strs[1])56 first, follow = first_follow(G)57 self.assertSetEqual({'(', 'id'}, first['E'])58 self.assertSetEqual({'(', 'id'}, first['T'])59 self.assertSetEqual({'(', 'id'}, first['F'])60 self.assertSetEqual({'+', '^'}, first["E'"])61 self.assertSetEqual({'*', '^'}, first["T'"])62 self.assertSetEqual({')', '$'}, follow['E'])63 self.assertSetEqual({')', '$'}, follow["E'"])64 self.assertSetEqual({'+', ')', '$'}, follow['T'])65 self.assertSetEqual({'+', ')', '$'}, follow["T'"])66 self.assertSetEqual({'+', '*', ')', '$'}, follow['F'])6768 with self.subTest(grammar_str=grammar_strs[2]):69 G = Grammar(grammar_strs[2])70 first, follow = first_follow(G)71 self.assertSetEqual({'('}, first['('])72 self.assertSetEqual({')'}, first[')'])73 self.assertSetEqual({'+'}, first['+'])74 self.assertSetEqual({'*'}, first['*'])75 self.assertSetEqual({'int'}, first['int'])76 self.assertSetEqual({'^', '*'}, first['Y'])77 self.assertSetEqual({'^', '+'}, first['X'])78 self.assertSetEqual({'int', '('}, first['T'])79 self.assertSetEqual({'int', '('}, first['E'])80 self.assertSetEqual({')', '$', '+'}, follow['Y'])81 self.assertSetEqual({')', '$'}, follow['X'])82 self.assertSetEqual({')', '$', '+'}, follow['T'])83 self.assertSetEqual({')', '$'}, follow['E'])8485 with self.subTest(grammar_str=grammar_strs[3]):86 G = Grammar(grammar_strs[3])87 first, follow = first_follow(G)88 self.assertSetEqual({'a'}, first['S'])89 self.assertSetEqual({'c'}, first['B'])90 self.assertSetEqual({'b', '^'}, first['C'])91 self.assertSetEqual({'g', 'f', '^'}, first['D'])92 self.assertSetEqual({'g', '^'}, first['E'])93 self.assertSetEqual({'f', '^'}, first['F'])94 self.assertSetEqual({'$'}, follow['S'])95 self.assertSetEqual({'g', 'f', 'h'}, follow['B'])96 self.assertSetEqual({'g', 'f', 'h'}, follow['C'])97 self.assertSetEqual({'h'}, follow['D'])98 self.assertSetEqual({'f', 'h'}, follow['E'])99 self.assertSetEqual({'h'}, follow['F'])100101 with self.subTest(grammar_str=grammar_strs[4]):102 G = Grammar(grammar_strs[4])103 first, follow = first_follow(G)104 self.assertSetEqual({'a'}, first['S'])105 self.assertSetEqual({'a'}, first['A'])106 self.assertSetEqual({'b'}, first['B'])107 self.assertSetEqual({'g'}, first['C'])108 self.assertSetEqual({'$'}, follow['S'])109 self.assertSetEqual({'$', 'd'}, follow['A'])110 self.assertSetEqual({'$', 'd'}, follow['B'])111 self.assertSetEqual(set(), follow['C'])112113 with self.subTest(grammar_str=grammar_strs[5]):114 G = Grammar(grammar_strs[5])115 first, follow = first_follow(G)116 self.assertSetEqual({'(', 'a'}, first['S'])117 self.assertSetEqual({'(', 'a'}, first['L'])118 self.assertSetEqual({',', '^'}, first["L'"])119 self.assertSetEqual({'$', ',', ')'}, follow['S'])120 self.assertSetEqual({')'}, follow['L'])121 self.assertSetEqual({')'}, follow["L'"])122123 with self.subTest(grammar_str=grammar_strs[6]):124 G = Grammar(grammar_strs[6])125 first, follow = first_follow(G)126 self.assertSetEqual({'a', 'b'}, first['S'])127 self.assertSetEqual({'^'}, first['A'])128 self.assertSetEqual({'^'}, first['B'])129 self.assertSetEqual({'$'}, follow['S'])130 self.assertSetEqual({'a', 'b'}, follow['A'])131 self.assertSetEqual({'a', 'b'}, follow['B'])132133 with self.subTest(grammar_str=grammar_strs[7]):134 G = Grammar(grammar_strs[7])135 first, follow = first_follow(G)136 self.assertSetEqual({'d', 'g', 'h', '^', 'b', 'a'}, first['S'])137 self.assertSetEqual({'d', 'g', 'h', '^'}, first['A'])138 self.assertSetEqual({'g', '^'}, first['B'])139 self.assertSetEqual({'h', '^'}, first['C'])140 self.assertSetEqual({'$'}, follow['S'])141 self.assertSetEqual({'h', 'g', '$'}, follow['A'])142 self.assertSetEqual({'$', 'a', 'h', 'g'}, follow['B'])143 self.assertSetEqual({'g', '$', 'b', 'h'}, follow['C'])144145 def test_CLOSURE(self):146 self.assertDictEqual(147 {"E'": {('.', 'E')}, 'E': {('.', 'E', '+', 'T'), ('.', 'T')}, 'T': {('.', 'T', '*', 'F'), ('.', 'F')},148 'F': {('.', '(', 'E', ')'), ('.', 'id')}},149 self.slr_parser.CLOSURE({self.slr_parser.G_prime.start: {('.', self.slr_parser.G_prime.start[:-1])}}))150151 grammar_str = """E -> + E"""152153 with self.subTest(grammar_str=grammar_str):154 G = Grammar(grammar_str)155 slr_parser = SLRParser(G)156157 self.assertDictEqual({'E': {('.', '+', 'E')}, "E'": {('.', 'E')}}, ...

Full Screen

Full Screen

test_memcell.py

Source:test_memcell.py Github

copy

Full Screen

...7 """ ORing A with itself does not destroys A, only F. But requires A8 as input, since it's value is used to compute F9 """10 c = memcell.MemCell('or a', 1)11 self.assertSetEqual(c.requires, {'a'})12 self.assertSetEqual(c.destroys, {'f'})13 def test_or_b(self):14 """ Test ORing with an 8 bit register, other than A15 """16 c = memcell.MemCell('or b', 1)17 self.assertSetEqual(c.requires, {'a', 'b'})18 self.assertSetEqual(c.destroys, {'a', 'f'})19 def test_cp_a(self):20 """ Comparing A with itself does not destroys A, only F.21 Does not requires A as input, since it's value is always known22 A is unchanged, F will have Z = 0, C = 0.23 Other values P/V, S are unknown, but not used by the compiler.24 """25 c = memcell.MemCell('cp a', 1)26 self.assertSetEqual(c.requires, set())27 self.assertSetEqual(c.destroys, {'f'})28 def test_cp_b(self):29 """ Test CPing with an 8 bit register, other than A30 """31 c = memcell.MemCell('cp b', 1)32 self.assertSetEqual(c.requires, {'a', 'b'})33 self.assertSetEqual(c.destroys, {'f'})34 def test_sub_a(self):35 """ Subtracting A with itself does not destroys A, only F.36 Does not requires A as input, since it's value is always known:37 A = 0, F will have Z = 0, C = 0.38 Other values P/V, S are unknown, but not used by the compiler.39 """40 c = memcell.MemCell('sub a', 1)41 self.assertSetEqual(c.requires, set())42 self.assertSetEqual(c.destroys, {'a', 'f'})43 def test_sub_b(self):44 """ Test subtracting with an 8 bit register, other than A45 """46 c = memcell.MemCell('sub b', 1)47 self.assertSetEqual(c.requires, {'a', 'b'})48 self.assertSetEqual(c.destroys, {'a', 'f'})49 def test_requires_pragma(self):50 """ Test requires function with #pragma opt require51 """52 c = memcell.MemCell('#pragma opt require hl, de, bc', 1)53 self.assertSetEqual(c.requires, {'h', 'l', 'd', 'e', 'b', 'c'})54 def test_require_ldir(self):55 """ Test requires of ldir instruction56 """57 c = memcell.MemCell('ldir', 1)58 self.assertSetEqual(c.requires, {'h', 'l', 'd', 'e', 'b', 'c'})59 self.assertSetEqual(c.destroys, {'h', 'l', 'd', 'e', 'b', 'c', 'f'})60 def test_require_ex_de_hl(self):61 """ Test requires of ex de, hl instruction62 """63 c = memcell.MemCell('ex de, hl', 1)64 self.assertSetEqual(c.requires, {'h', 'l', 'd', 'e'})65 self.assertSetEqual(c.destroys, {'h', 'l', 'd', 'e'})66 def test_require_add_hl(self):67 """ Test requires of add hl, NN instruction68 """69 c = memcell.MemCell('add hl, de', 1)70 self.assertSetEqual(c.requires, {'h', 'l', 'd', 'e'})71 self.assertSetEqual(c.destroys, {'h', 'l', 'f'})72 c = memcell.MemCell('add hl, bc', 1)73 self.assertSetEqual(c.requires, {'h', 'l', 'b', 'c'})74 self.assertSetEqual(c.destroys, {'h', 'l', 'f'})75 def test_require_sbc_hl(self):76 """ Test requires of add hl, NN instruction77 """78 c = memcell.MemCell('sbc hl, de', 1)79 self.assertSetEqual(c.requires, {'h', 'l', 'd', 'e', 'f'})80 self.assertSetEqual(c.destroys, {'h', 'l', 'f'})81 c = memcell.MemCell('sbc hl, bc', 1)82 self.assertSetEqual(c.requires, {'h', 'l', 'b', 'c', 'f'})83 self.assertSetEqual(c.destroys, {'h', 'l', 'f'})84 def test_require_sbc_a_a(self):85 """ Test requires of sbc a, a instruction86 """87 c = memcell.MemCell('sbc a, a', 1)88 self.assertSetEqual(c.requires, {'f'})89 self.assertSetEqual(c.destroys, {'a', 'f'})90 def test_require_sub_1(self):91 """ Test requires of sub 1 instruction92 """93 c = memcell.MemCell('sub 1', 1)94 self.assertSetEqual(c.requires, {'a'})95 self.assertSetEqual(c.destroys, {'a', 'f'})96 def test_require_destroys_asm(self):97 """ For a user memory block, returns the list of required (ALL)98 and destroyed (ALL) registers99 """100 src.arch.zx48k.backend.ASMS['##ASM0'] = ['nop']101 c = memcell.MemCell('##ASM0', 1)102 self.assertEqual(c.destroys, {'a', 'b', 'c', 'd', 'e', 'f', 'h', 'l', 'ixh', 'ixl', 'iyh', 'iyl',103 'r', 'i', 'sp'})104 self.assertEqual(c.requires, {'a', 'b', 'c', 'd', 'e', 'f', 'h', 'l', 'ixh', 'ixl', 'iyh', 'iyl',105 'r', 'i', 'sp'})106 del src.arch.zx48k.backend.ASMS['##ASM0']107 def test_requires_xor_a(self):108 """ Test requires for xor a instruction109 """110 c = memcell.MemCell('xor a', 1)111 self.assertSetEqual(c.requires, set())112 self.assertSetEqual(c.destroys, {'a', 'f'})113 def test_require_out(self):114 """ Test requires for out(c), a instruction115 """116 c = memcell.MemCell('out (c), a', 1)117 self.assertSetEqual(c.requires, {'a', 'b', 'c'})118 self.assertSetEqual(c.destroys, set())119 c = memcell.MemCell('out (c), d', 1)120 self.assertSetEqual(c.requires, {'d', 'b', 'c'})121 self.assertSetEqual(c.destroys, set())122 def test_require_in(self):123 """ Test requires for out(c), a instruction124 """125 c = memcell.MemCell('in a, (c)', 1)126 self.assertSetEqual(c.requires, {'b', 'c'})127 self.assertSetEqual(c.destroys, {'a'})128 c = memcell.MemCell('in d, (c)', 1)129 self.assertSetEqual(c.requires, {'b', 'c'})130 self.assertSetEqual(c.destroys, {'d'})131 def test_require_ld_NN_a(self):132 """ Test requires for ld (NN), a instruction133 """134 c = memcell.MemCell('ld (_push), a', 1)135 self.assertSetEqual(c.requires, {'a'})...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful