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

mattonem / PharoJS / 13812362614

11 Mar 2025 04:04PM UTC coverage: 42.026% (-17.4%) from 59.444%
13812362614

push

github

mattonem
more catching

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

3707 existing lines in 69 files now uncovered.

8909 of 21199 relevant lines covered (42.03%)

0.42 hits per line

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

0.0
/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' }
13
PjSortedCollectionTest >> atRandomAddAll: elements [
×
14
        | toInsert |
×
15
        toInsert := Set withAll: elements.
×
16
         toInsert size timesRepeat: [
×
17
                |inserted|
×
18
                inserted := toInsert atRandom.
×
19
                collection add: inserted.
×
20
                toInsert remove: inserted].
×
21
]
×
22

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

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

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

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

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

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

80
{ #category : 'tests' }
81
PjSortedCollectionTest >> testSortingNumbersSmallerFirst [
×
82
        self atRandomAddAll: (1 to: 10).
×
83
        (1 to: 10) do: [ : index |
×
84
                self assert: (collection at: index) equals: index ]
×
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