From 2dda3b9a24e459b9dfb56915d5e75f0a92326086 Mon Sep 17 00:00:00 2001 From: lykimq Date: Tue, 15 Nov 2022 09:03:11 +0700 Subject: [PATCH 1/2] Tezt: add big_map to self tests --- tezt/tests/contract_big_map_to_self.ml | 71 ++++++++++++++++++++++++++ tezt/tests/main.ml | 1 + 2 files changed, 72 insertions(+) create mode 100644 tezt/tests/contract_big_map_to_self.ml 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 000000000000..36f91c59a9ab --- /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 60a2dad1b47e..97c7d963c49a 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 ; -- GitLab From 9be94a4379e0d2a2c7953dcd4941de5bb7567611 Mon Sep 17 00:00:00 2001 From: lykimq Date: Tue, 15 Nov 2022 09:05:22 +0700 Subject: [PATCH 2/2] Test/Python: remove Big_map to self test --- tests_python/tests_014/test_contract.py | 16 ---------------- tests_python/tests_015/test_contract.py | 16 ---------------- tests_python/tests_alpha/test_contract.py | 16 ---------------- 3 files changed, 48 deletions(-) diff --git a/tests_python/tests_014/test_contract.py b/tests_python/tests_014/test_contract.py index feefa2bf77d8..adb8f207f43a 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 feefa2bf77d8..adb8f207f43a 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 feefa2bf77d8..adb8f207f43a 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: -- GitLab