Machx/Konkyo

Investigate dictionary test randomly failing

Machx opened this issue · 1 comments

Machx commented
	func testDictionaryLiteralAndSetLimit() {
		var dictionary: RollingDictionary = ["A": 1, "B": 2]
		
		XCTAssertNotNil(dictionary)
		XCTAssertEqual(dictionary["A"], 1)
		XCTAssertEqual(dictionary["B"], 2)
		
		dictionary.setLimit(1)
		XCTAssertEqual(dictionary.getKeyLimit(), 1)
		
		//
		XCTAssertNil(dictionary["A"])     // <-- FAIL HERE
		XCTAssertNotNil(dictionary["B"]) // <-- FAIL HERE
	}

The test randomly fails. I'm guessing the key orders aren't preserved or something like that.

Machx commented

I think this issue was likely fixed in 7e72d9a . But I refactored a bunch of code and everything seems to be working fine now. I hope my ordering code fixes everything.