diff --git a/crates/pyrometer/tests/test_data/delete.sol b/crates/pyrometer/tests/test_data/delete.sol index 91e2a42b..685175b5 100644 --- a/crates/pyrometer/tests/test_data/delete.sol +++ b/crates/pyrometer/tests/test_data/delete.sol @@ -135,4 +135,71 @@ contract ComplexDelete { function clearAllEducationHistory(uint256 userId) public { delete users[userId].educationHistory; } + +} + +contract UseComplexDelete { + ComplexDelete t; + + constructor() { + t = new ComplexDelete(); + } + + function useIt() public { + // Add users + t.addUser(1, "Alice", "alice@example.com", "1234567890"); + t.addUser(2, "Bob", "bob@example.com", "0987654321"); + + // Add addresses + t.addUserAddress(1, "123 Main St", "New York", "USA", 10001); + t.addUserAddress(1, "456 Elm St", "Los Angeles", "USA", 90001); + t.addUserAddress(2, "789 Oak St", "Chicago", "USA", 60601); + + // Add employment history + t.addEmploymentHistory(1, "TechCorp", "Developer", 1609459200, 1640995200); + t.addEmploymentHistory(1, "WebSoft", "Senior Developer", 1641081600, 0); + t.addEmploymentHistory(2, "DataFirm", "Analyst", 1577836800, 0); + + // Add education history + t.addEducationHistory(1, "Tech University", "BSc Computer Science", 2020); + t.addEducationHistory(2, "Data College", "MSc Data Science", 2019); + + // Set preferences + t.setUserPreference(1, "receiveNewsletter", true); + t.setUserPreference(1, "darkMode", false); + t.setUserPreference(2, "receiveNewsletter", false); + + // Test deletions and updates + + // Delete an address + t.deleteUserAddress(1, 0); + + // Delete employment history + t.deleteEmploymentHistory(1, 0); + + // Delete education history + t.deleteEducationHistory(2, 0); + + // Delete user preference + t.deleteUserPreference(1, "darkMode"); + + // Update contact info + t.updateContactInfo(2, "bob.new@example.com", "1122334455"); + + // Clear all addresses for a user + t.clearAllUserAddresses(1); + + // Clear all employment history for a user + t.clearAllEmploymentHistory(2); + + // Clear all education history for a user + t.clearAllEducationHistory(1); + + // Delete an entire user + t.deleteUser(1); + + // Add a new user to test after deletions + t.addUser(3, "Charlie", "charlie@example.com", "5556667777"); + t.addUserAddress(3, "321 Pine St", "San Francisco", "USA", 94101); + } } \ No newline at end of file