Skip to content

[Add]: unit tests for special parameter position for ContractMethod#3697

Merged
shargon merged 2 commits intoneo-project:masterfrom
nan01ab:feat.add-some-ut-tests
Jan 26, 2025
Merged

[Add]: unit tests for special parameter position for ContractMethod#3697
shargon merged 2 commits intoneo-project:masterfrom
nan01ab:feat.add-some-ut-tests

Conversation

@nan01ab
Copy link
Contributor

@nan01ab nan01ab commented Jan 24, 2025

The ContractMethod has an implicit requirement for the 'ApplicationEngine' or 'DataCache' parameter: It must be the first parameter.
Add tests for this implicit requirement.

Description

Fixes # (issue)

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Test: add tests for implicit requirement of 'ApplicationEngine', 'DataCache' and 'IReadOnlyStoreView' parameter position in ContractMethod
@nan01ab nan01ab changed the title [Add]: unit test for special parameter position for ContractMethod [Add]: unit tests for special parameter position for ContractMethod Jan 24, 2025
Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

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

A good test should be if you check that all the native contracts that use these types are in the first place

@nan01ab
Copy link
Contributor Author

nan01ab commented Jan 25, 2025

A good test should be if you check that all the native contracts that use these types are in the first place

All native contracts are checked.
https://github.com/neo-project/neo/pull/3697/files#diff-e40cd1228ce247a2a509e503b44e5968cb899fb67a686273016f8435d1fa428cR194

@shargon
Copy link
Member

shargon commented Jan 25, 2025

How can the coverage be less than before 😅

@nan01ab
Copy link
Contributor Author

nan01ab commented Jan 26, 2025

How can the coverage be less than before 😅

Only unit test code added.

It should be statistical error.

@cschuchardt88
Copy link
Member

How can the coverage be less than before 😅

Only unit test code added.

It should be statistical error.

Yes your right. This happens all the time. Because coverage/coveralls website we use factors in unit tests. Whats that mean? That the unit test itself doesn't have coverage. its a bug in their system.

@shargon shargon merged commit 646c45b into neo-project:master Jan 26, 2025
6 checks passed
@shargon
Copy link
Member

shargon commented Jan 26, 2025

We have non deterministic unit tests, and sometimes is bigger and sometimes is lower

Jim8y added a commit to Jim8y/neo that referenced this pull request Jan 31, 2025
* master: (43 commits)
  Fix `GetAndChange` warnings (neo-project#3702)
  `Murmur3` should not be cryptographic hash algorithm (neo-project#3668)
  Test: add tests for native contract id (neo-project#3697)
  Update nugets (neo-project#3692)
  [Core P2P] fix the bug (neo-project#3695)
  Add hardfork HF_Echidna (neo-project#3454)
  Fix: add lock for RocksDbStore.Snapshot to keep same behavior as MemoryStore and LevelDbStore (neo-project#3689)
  Nullable rocks db (neo-project#3686)
  Nullable leveldb (neo-project#3685)
  Enforcement Compiler Warnings (neo-project#3687)
  [`Update`] Dotnet & Compiler Version (neo-project#3684)
  [`Add`]: LevelDB Benchmarks (neo-project#3667)
  [`Fix`]: Behavior when `keyPrefix` is null in different `IStore.Seek` impls. (neo-project#3682)
  Improve calculatenetworkfee (neo-project#3674)
  more 2025 (neo-project#3678)
  Nullable in Storage classes (neo-project#3670)
  readonly (neo-project#3676)
  [Fix] Set max entries for `VerifyProof` in `statePlugin` (neo-project#3675)
  Neo.json.benchmarks (neo-project#3673)
  Happy new year 2025 (neo-project#3677)
  ...

# Conflicts:
#	src/Neo/Neo.csproj
#	src/Neo/ProtocolSettings.cs
#	src/Neo/SmartContract/ApplicationEngine.cs
#	src/Neo/SmartContract/Native/NeoToken.cs
#	src/Neo/SmartContract/Native/RoleManagement.cs
#	tests/Neo.UnitTests/SmartContract/Native/UT_NativeContract.cs
@nan01ab nan01ab deleted the feat.add-some-ut-tests branch February 5, 2025 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants