• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mattonem / PharoJS / 13784210198

11 Mar 2025 09:06AM UTC coverage: 59.622% (-1.0%) from 60.626%
13784210198

push

github

mattonem
wtf

2 of 2 new or added lines in 1 file covered. (100.0%)

537 existing lines in 12 files now uncovered.

12573 of 21088 relevant lines covered (59.62%)

0.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

6.78
/Pharo/PharoJs-Base-JS-CoreLibraries-Tests/PjSortedCollectionTest.class.st
1
Class {
2
        #name : 'PjSortedCollectionTest',
3
        #superclass : 'PjBridgeTestCase',
4
        #instVars : [
5
                'collection'
6
        ],
7
        #category : 'PharoJs-Base-JS-CoreLibraries-Tests-Collections',
8
        #package : 'PharoJs-Base-JS-CoreLibraries-Tests',
9
        #tag : 'Collections'
10
}
11

12
{ #category : 'utilities' }
UNCOV
13
PjSortedCollectionTest >> atRandomAddAll: elements [
×
UNCOV
14
        | toInsert |
×
UNCOV
15
        toInsert := Set withAll: elements.
×
UNCOV
16
         toInsert size timesRepeat: [
×
UNCOV
17
                |inserted|
×
UNCOV
18
                inserted := toInsert atRandom.
×
UNCOV
19
                collection add: inserted.
×
UNCOV
20
                toInsert remove: inserted].
×
UNCOV
21
]
×
22

23
{ #category : 'running' }
24
PjSortedCollectionTest >> setUp [
1✔
25
        super setUp.
1✔
26
        collection := self evalBlock: [ SortedCollection new ]
1✔
27
]
1✔
28

29
{ #category : 'tests' }
UNCOV
30
PjSortedCollectionTest >> testAllButLast [
×
UNCOV
31
        | allButLast |
×
UNCOV
32
        1 to: 4 do: [:each|
×
UNCOV
33
                collection add: each].
×
UNCOV
34
        allButLast := collection allButLast.
×
UNCOV
35
        self assert: allButLast size equals: 3.
×
UNCOV
36
        1 to: 3 do: [ : each |
×
UNCOV
37
                self assert: (allButLast at: each) equals: each.
×
UNCOV
38
        ].
×
UNCOV
39
]
×
40

41
{ #category : 'tests' }
UNCOV
42
PjSortedCollectionTest >> testCollect [
×
UNCOV
43
        collection := self evalBlock: [ 
×
UNCOV
44
                |s|
×
UNCOV
45
                s := SortedCollection  new.
×
UNCOV
46
                s add: 3; add: 1.
×
UNCOV
47
                s collect: [: each | each ]].
×
UNCOV
48
        self assert: collection size equals: 2.
×
UNCOV
49
        self assert: collection first equals: 1.
×
UNCOV
50
        self assert: collection last equals: 3.
×
UNCOV
51
]
×
52

53
{ #category : 'tests' }
UNCOV
54
PjSortedCollectionTest >> testReSortingNumbers [
×
UNCOV
55
        self evalBlock: [ collection sortBlock: [ : a : b | a <= b ] ].
×
UNCOV
56
        self atRandomAddAll: (1 to: 10).
×
UNCOV
57
        self evalBlock: [ collection sortBlock: [ : a : b | a >= b ] ].
×
UNCOV
58
        (1 to: 10) with: (1 to: 10) reversed do: [ : index : expectedValue |
×
UNCOV
59
                self assert: (collection at: index) equals: expectedValue ]
×
UNCOV
60
]
×
61

62
{ #category : 'tests' }
UNCOV
63
PjSortedCollectionTest >> testShallowCopy [
×
UNCOV
64
        | clone |
×
UNCOV
65
        self atRandomAddAll: (1 to: 10).
×
UNCOV
66
        clone := collection copy.
×
UNCOV
67
        self assert: clone size equals: 10.
×
UNCOV
68
        (1 to: 10) do: [ : index |
×
UNCOV
69
                self assert: (clone at: index) equals: index ]
×
UNCOV
70
]
×
71

72
{ #category : 'tests' }
UNCOV
73
PjSortedCollectionTest >> testSortingNumbersGreaterFirst [
×
UNCOV
74
        self evalBlock: [ collection sortBlock: [ : a : b | a >=b ] ].
×
UNCOV
75
        self atRandomAddAll: (1 to: 10).
×
UNCOV
76
        (1 to: 10) with: (1 to: 10) reversed do: [ : index : expectedValue |
×
UNCOV
77
                self assert: (collection at: index) equals: expectedValue ]
×
UNCOV
78
]
×
79

80
{ #category : 'tests' }
UNCOV
81
PjSortedCollectionTest >> testSortingNumbersSmallerFirst [
×
UNCOV
82
        self atRandomAddAll: (1 to: 10).
×
UNCOV
83
        (1 to: 10) do: [ : index |
×
UNCOV
84
                self assert: (collection at: index) equals: index ]
×
UNCOV
85
]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc