diff --git a/tests_python/tests_014/test_contract.py b/tests_python/tests_014/test_contract.py index feefa2bf77d8fe48e1bcde71aa6a79f270df2d42..adb8f207f43a59fd68b965b24fa496335b5a36ee 100644 --- a/tests_python/tests_014/test_contract.py +++ b/tests_python/tests_014/test_contract.py @@ -1043,22 +1043,6 @@ class TestChainId: utils.bake(client, bake_for='bootstrap5') -@pytest.mark.incremental -@pytest.mark.contract -class TestBigMapToSelf: - def test_big_map_to_self_origination(self, client: Client, session: dict): - path = os.path.join(CONTRACT_PATH, 'opcodes', 'big_map_to_self.tz') - originate(client, session, path, '{}', 0) - utils.bake(client, bake_for='bootstrap5') - - def test_big_map_to_self_transfer(self, client: Client): - client.call('bootstrap2', "big_map_to_self", []) - utils.bake(client, bake_for='bootstrap5') - - client.transfer(0, 'bootstrap2', "big_map_to_self", []) - utils.bake(client, bake_for='bootstrap5') - - @pytest.mark.incremental @pytest.mark.contract class TestNonRegression: diff --git a/tests_python/tests_015/test_contract.py b/tests_python/tests_015/test_contract.py index feefa2bf77d8fe48e1bcde71aa6a79f270df2d42..adb8f207f43a59fd68b965b24fa496335b5a36ee 100644 --- a/tests_python/tests_015/test_contract.py +++ b/tests_python/tests_015/test_contract.py @@ -1043,22 +1043,6 @@ class TestChainId: utils.bake(client, bake_for='bootstrap5') -@pytest.mark.incremental -@pytest.mark.contract -class TestBigMapToSelf: - def test_big_map_to_self_origination(self, client: Client, session: dict): - path = os.path.join(CONTRACT_PATH, 'opcodes', 'big_map_to_self.tz') - originate(client, session, path, '{}', 0) - utils.bake(client, bake_for='bootstrap5') - - def test_big_map_to_self_transfer(self, client: Client): - client.call('bootstrap2', "big_map_to_self", []) - utils.bake(client, bake_for='bootstrap5') - - client.transfer(0, 'bootstrap2', "big_map_to_self", []) - utils.bake(client, bake_for='bootstrap5') - - @pytest.mark.incremental @pytest.mark.contract class TestNonRegression: diff --git a/tests_python/tests_alpha/test_contract.py b/tests_python/tests_alpha/test_contract.py index feefa2bf77d8fe48e1bcde71aa6a79f270df2d42..adb8f207f43a59fd68b965b24fa496335b5a36ee 100644 --- a/tests_python/tests_alpha/test_contract.py +++ b/tests_python/tests_alpha/test_contract.py @@ -1043,22 +1043,6 @@ class TestChainId: utils.bake(client, bake_for='bootstrap5') -@pytest.mark.incremental -@pytest.mark.contract -class TestBigMapToSelf: - def test_big_map_to_self_origination(self, client: Client, session: dict): - path = os.path.join(CONTRACT_PATH, 'opcodes', 'big_map_to_self.tz') - originate(client, session, path, '{}', 0) - utils.bake(client, bake_for='bootstrap5') - - def test_big_map_to_self_transfer(self, client: Client): - client.call('bootstrap2', "big_map_to_self", []) - utils.bake(client, bake_for='bootstrap5') - - client.transfer(0, 'bootstrap2', "big_map_to_self", []) - utils.bake(client, bake_for='bootstrap5') - - @pytest.mark.incremental @pytest.mark.contract class TestNonRegression: diff --git a/tezt/tests/contract_big_map_to_self.ml b/tezt/tests/contract_big_map_to_self.ml new file mode 100644 index 0000000000000000000000000000000000000000..36f91c59a9ab61f7f8012e1aa980b33e7e75ff08 --- /dev/null +++ b/tezt/tests/contract_big_map_to_self.ml @@ -0,0 +1,71 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2020 Nomadic Labs *) +(* Copyright (c) 2022 Marigold *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +(* Testing + ------- + Component: Michelson + Invocation: dune exec tezt/tests/main.exe -- --file contract_big_map_to_self.ml + Subject: Tests sending big_map to self +*) + +let contract_path protocol kind contract = + sf + "tests_python/contracts_%s/%s/%s" + (match protocol with + | Protocol.Alpha -> "alpha" + | _ -> sf "%03d" @@ Protocol.number protocol) + kind + contract + +let test_big_map_to_self = + Protocol.register_test + ~__FILE__ + ~title:"Test sending big_map to self" + ~tags:["client"; "michelson"] + @@ fun protocol -> + let* client = Client.init_mockup ~protocol () in + let prg = contract_path protocol "opcodes" "big_map_to_self.tz" in + let* contract = + Client.originate_contract + ~alias:"big_map_to_self" + ~amount:Tez.zero + ~src:"bootstrap5" + ~prg + ~init:"{}" + ~burn_cap:Tez.one + client + in + let* () = + Client.transfer + ~burn_cap:Tez.one + ~amount:Tez.zero + ~giver:"bootstrap2" + ~receiver:contract + client + in + unit + +let register ~protocols = test_big_map_to_self protocols diff --git a/tezt/tests/main.ml b/tezt/tests/main.ml index 60a2dad1b47e91bef94f308e4b015515168a12d8..97c7d963c49a5e57d9da459835926b0d271f7377 100644 --- a/tezt/tests/main.ml +++ b/tezt/tests/main.ml @@ -107,6 +107,7 @@ let register_protocol_tests_that_use_supports_correctly () = Client_config.register ~protocols ; Client_run_view.register ~protocols ; Comparable_datatype.register ~protocols ; + Contract_big_map_to_self.register ~protocols ; Contract_entrypoints.register ~protocols ; Contract_hash_fun.register ~protocols ; Contract_hash_with_origination.register ~protocols ;