File tree Expand file tree Collapse file tree 2 files changed +62
-0
lines changed
Tests/OpenAttributeGraphCxxTests/Util Expand file tree Collapse file tree 2 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ let openAttributeGraphCxxTestsTarget = Target.testTarget(
176176 " OpenAttributeGraphCxx " ,
177177 ] ,
178178 exclude: [ " README.md " ] ,
179+ cSettings: sharedCSettings + [ . define( " SWIFT_TESTING " ) ] ,
179180 swiftSettings: sharedSwiftSettings + [ . interoperabilityMode( . Cxx) ]
180181)
181182let openAttributeGraphShimsTestsTarget = Target . testTarget (
Original file line number Diff line number Diff line change 1+ //
2+ // ForwardListTests.swift
3+ // OpenAttributeGraphCxxTests
4+
5+ import OpenAttributeGraphCxx_Private. Util
6+ import Testing
7+
8+ struct ForwardListTests {
9+ @Test
10+ func forwardListBasicOperations( ) {
11+ let list = util. UInt64ForwardList. create ( )
12+ defer { util. UInt64ForwardList. destroy ( list) }
13+
14+ // Test empty list
15+ #expect( list. empty ( ) )
16+
17+ // Test push_front and empty state
18+ list. push_front ( 42 )
19+ #expect( !list. empty ( ) )
20+
21+ // Test front access
22+ #expect( list. front ( ) == 42 )
23+
24+ // Test multiple push_front operations
25+ list. push_front ( 100 )
26+ #expect( list. front ( ) == 100 )
27+
28+ list. push_front ( 200 )
29+ #expect( list. front ( ) == 200 )
30+
31+ // Test pop_front
32+ list. pop_front ( )
33+ #expect( list. front ( ) == 100 )
34+
35+ list. pop_front ( )
36+ #expect( list. front ( ) == 42 )
37+
38+ list. pop_front ( )
39+ #expect( list. empty ( ) )
40+ }
41+
42+ @Test
43+ func forwardListSequentialOperations( ) {
44+ let list = util. UInt64ForwardList. create ( )
45+ defer { util. UInt64ForwardList. destroy ( list) }
46+
47+ // Add multiple elements
48+ for i in 0 ..< 5 {
49+ list. push_front ( UInt64 ( i) )
50+ }
51+
52+ // Remove all elements and verify order (LIFO - last in, first out)
53+ for i in ( 0 ..< 5 ) . reversed ( ) {
54+ #expect( !list. empty ( ) )
55+ #expect( list. front ( ) == UInt64 ( i) )
56+ list. pop_front ( )
57+ }
58+
59+ #expect( list. empty ( ) )
60+ }
61+ }
You can’t perform that action at this time.
0 commit comments