Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for ESDT new feature #2851

Merged

Conversation

miiu96
Copy link
Contributor

@miiu96 miiu96 commented Feb 25, 2021

  • Added unit tests for files esdtLocalBurn.go, esdtLocalMint.go, esdtRoles.go
  • Added unit tests for file esdt.go
  • Added semi-integrations tests for the local mint built in function and the local burn built in function
  • Added integration tests for the new functionalities

@sasurobert sasurobert self-requested a review February 25, 2021 15:33
sasurobert
sasurobert previously approved these changes Feb 25, 2021
@miiu96 miiu96 changed the title Unit tests new built in functions Test for ESDT new feature Mar 1, 2021
@miiu96 miiu96 changed the title Test for ESDT new feature Tests for ESDT new feature Mar 1, 2021
if err != nil {
return nil, err
}

value := big.NewInt(0).SetBytes(vmInput.Arguments[1])
err = addToESDTBalance(vmInput.CallerAddr, acntSnd, esdtTokenKey, big.NewInt(0).Set(value), e.marshalizer, e.pauseHandler)
sdtTokenKey := append(e.keyPrefix, tokenID...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esdtTokenKey

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

exError: process.ErrNilMarshalizer,
},
{
name: "NilPouseHandler",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NilPauseHandler instead NilPouseHandler

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

exError: process.ErrNilMarshalizer,
},
{
name: "NilPouseHandler",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NilPauseHandler instead NilPouseHandler

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

require.Equal(t, localErr, err)
}

func TestEsdtRoles_ProcessBuiltinFunction_UnsetRolesDoesNotExitsShouldWork(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exist instead Exits

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

require.Nil(t, err)
}

func TestEsdtRolest_CheckAllowedToExecuteRoleNotFind(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roles instead Rolest

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

require.Equal(t, vmcommon.UserError, retCode)
}

func TestEsdt_SetSpecialRoleAlreadyExits(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exists instead Exits

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

require.Equal(t, vmcommon.UserError, retCode)
}

func TestEsdt_GetAllAddressesAndRoleCallWithValueShouldErr(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AndRoles

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

require.Equal(t, vmcommon.UserError, retCode)
}

func TestEsdt_GetAllAddressesAndRoleCallGetExistingTokenErr(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AndRoles

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done/

require.Equal(t, vmcommon.UserError, retCode)
}

func TestEsdt_UnsetSpecialRoleCannotRemoveRoleNotExitsShouldErr(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exists instead Exits

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

sasurobert
sasurobert previously approved these changes Mar 2, 2021
SebastianMarian
SebastianMarian previously approved these changes Mar 2, 2021
@miiu96 miiu96 dismissed stale reviews from SebastianMarian and sasurobert via 56b5cc8 March 2, 2021 14:42
Copy link
Contributor

@0xmtf 0xmtf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System test passed

@sasurobert sasurobert merged commit 31f94dd into feat/eip-esdt-local-mint Mar 2, 2021
@sasurobert sasurobert deleted the unit-tests-new-built-in-functions branch March 2, 2021 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants