Skip to content

Commit 278465c

Browse files
authored
Update vesting_tests.move
1 parent f38d0f9 commit 278465c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

vesting/tests/vesting_tests.move

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
#[test_only]
22
module 0xb35962eed27b9a272d82673f2b7a99e7257b7b1a9af02c1a09143dacbaf498bd::vesting_tests {
3+
use 0x1::signer;
34
use Vesting::vesting;
45

6+
// Позитив: линейный вестинг отдаёт 30 -> 80 -> 100
57
#[test(admin = @0xA, ben = @0xB)]
68
public entry fun test_linear_release_ok(admin: &signer, ben: &signer) {
9+
let _ = signer::address_of(ben); // чтобы не было ворнинга
710
let admin_addr = @0xA;
811
let ben_addr = @0xB;
912

1013
vesting::init(admin);
1114
vesting::create(admin, ben_addr, /*total*/ 100, /*start*/ 0, /*end*/ 100);
1215

13-
// t=30 -> 30
1416
vesting::claim(ben, admin_addr, 0, 30);
1517
assert!(vesting::view_balance(admin_addr, ben_addr) == 30, 0);
1618

17-
// t=80 -> стало 80 (доклеймится +50)
1819
vesting::claim(ben, admin_addr, 0, 80);
1920
assert!(vesting::view_balance(admin_addr, ben_addr) == 80, 1);
2021

21-
// t=200 -> стало 100 (доклеймится +20)
2222
vesting::claim(ben, admin_addr, 0, 200);
2323
assert!(vesting::view_balance(admin_addr, ben_addr) == 100, 2);
2424
}
2525

2626
// Негатив: клеймит не бенефициар -> E_NOT_BENEFICIARY = 4
2727
#[test(admin = @0xA, ben = @0xB)]
2828
#[expected_failure(abort_code = 4, location = Vesting::vesting)]
29-
public entry fun test_wrong_beneficiary_fails(admin: &signer, _ben: &signer) {
29+
public entry fun test_wrong_beneficiary_fails(admin: &signer, ben: &signer) {
30+
let _ = signer::address_of(ben);
3031
let admin_addr = @0xA;
3132
let ben_addr = @0xB;
3233

@@ -36,11 +37,12 @@ module 0xb35962eed27b9a272d82673f2b7a99e7257b7b1a9af02c1a09143dacbaf498bd::vesti
3637
vesting::claim(admin, admin_addr, 0, 5);
3738
}
3839

39-
// Негатив: плохое время в create -> E_BAD_TIME = 3
40+
// Негатив: плохое расписание (end <= start) -> E_BAD_TIME = 3
4041
#[test(admin = @0xA)]
4142
#[expected_failure(abort_code = 3, location = Vesting::vesting)]
4243
public entry fun test_bad_time_fails(admin: &signer) {
4344
vesting::init(admin);
44-
vesting::create(admin, @0xB, 100, /*start*/ 50, /*end*/ 50);
45+
// end == start — некорректно
46+
vesting::create(admin, @0xB, 100, 10, 10);
4547
}
4648
}

0 commit comments

Comments
 (0)