Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
enderNakamoto committed Dec 19, 2024
1 parent ae47412 commit cb9d28e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions test/CarbonIntegrationTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ contract CarbonIntegrationTest is Test {
assertEq(controller.totalCreditsBurned(), 0, "Total credits burned should be 0");

// Tesla1 drives 350 miles (3 credits)
controller.registerVehicle(tesla1, "TESLA2023_1");
controller.registerVehicle(tesla1, "5YJSA1S12EFP29403");
controller.processOdometerReading(tesla1, 350);
assertEq(controller.carbonQueue()._getAvailableCredits(), 3, "Queue should have 3 credits after Tesla1");

// Tesla2 drives 250 miles (2 credits)
controller.registerVehicle(tesla2, "TESLA2023_2");
controller.registerVehicle(tesla2, "5YJSA1DP9CFP03055");
controller.processOdometerReading(tesla2, 250);
assertEq(controller.carbonQueue()._getAvailableCredits(), 5, "Queue should have 5 total credits");

Expand Down
30 changes: 15 additions & 15 deletions test/ControllerTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ contract ControllerTest is Test {
}

function test_VehicleRegistration() public {
string memory vin = "VIN123";
string memory vin = "5YJSA3H10EFP46509";

vm.prank(owner);
vm.expectEmit(true, false, false, true);
Expand All @@ -66,7 +66,7 @@ contract ControllerTest is Test {
}

function test_DuplicateRegistrationFails() public {
string memory vin = "VIN123";
string memory vin = "5YJSA3H10EFP46509";

vm.startPrank(owner);
controller.registerVehicle(driver1, vin);
Expand All @@ -75,7 +75,7 @@ contract ControllerTest is Test {
controller.registerVehicle(driver2, vin);

vm.expectRevert("Address already has vehicle");
controller.registerVehicle(driver1, "VIN456");
controller.registerVehicle(driver1, "5YJSA1S12EFP29403");
vm.stopPrank();
}

Expand Down Expand Up @@ -140,7 +140,7 @@ contract ControllerTest is Test {
}

function test_OdometerProcessing() public {
string memory vin = "VIN123";
string memory vin = "5YJSA3H10EFP46509";

// Register vehicle
vm.prank(owner);
Expand Down Expand Up @@ -183,7 +183,7 @@ contract ControllerTest is Test {
}

function test_OdometerProcessingErrors() public {
string memory vin = "VIN123";
string memory vin = "5YJSA3H10EFP46509";

// Try to process reading for unregistered vehicle
vm.prank(odometerProcessor);
Expand Down Expand Up @@ -211,7 +211,7 @@ contract ControllerTest is Test {
}

function test_OdometerProcessingSmallIncrements() public {
string memory vin = "VIN123";
string memory vin = "5YJSA3H10EFP46509";

// Register vehicle
vm.prank(owner);
Expand All @@ -237,7 +237,7 @@ contract ControllerTest is Test {
}

function test_BurnCredit() public {
string memory vin = "VIN123";
string memory vin = "5YJSA3H10EFP46509";

// Setup: Register vehicle and generate credits
vm.prank(owner);
Expand Down Expand Up @@ -274,7 +274,7 @@ contract ControllerTest is Test {
}

function test_BurnCreditErrors() public {
string memory vin = "VIN123";
string memory vin = "5YJSA3H10EFP46509";

// Setup: Register vehicle and generate credits
vm.prank(owner);
Expand Down Expand Up @@ -306,8 +306,8 @@ contract ControllerTest is Test {
}

function test_MultipleBurnCredits() public {
string memory vin1 = "VIN123";
string memory vin2 = "VIN456";
string memory vin1 = "5YJSA3H10EFP46509";
string memory vin2 = "5YJSA1S12EFP29403";

// Setup: Register vehicles and generate credits
controller.registerVehicle(driver1, vin1);
Expand Down Expand Up @@ -344,7 +344,7 @@ contract ControllerTest is Test {
}

function test_WithdrawRewards() public {
string memory vin = "VIN123";
string memory vin = "5YJSA3H10EFP46509";

// Setup: Register vehicle and generate credits
controller.registerVehicle(driver1, vin);
Expand Down Expand Up @@ -376,7 +376,7 @@ contract ControllerTest is Test {
}

function test_WithdrawRewardsMultipleBurns() public {
string memory vin = "VIN123";
string memory vin = "5YJSA3H10EFP46509";

// Setup: Generate credits
controller.registerVehicle(driver1, vin);
Expand Down Expand Up @@ -425,8 +425,8 @@ contract ControllerTest is Test {

function test_WithdrawRewardsMultipleDrivers() public {
// Setup: Register vehicles and generate credits
controller.registerVehicle(driver1, "VIN123");
controller.registerVehicle(driver2, "VIN456");
controller.registerVehicle(driver1, "5YJSA3H10EFP46509");
controller.registerVehicle(driver2, "5YJSA1S12EFP29403");
vm.startPrank(odometerProcessor);
controller.processOdometerReading(driver1, 300); // 3 credits
controller.processOdometerReading(driver2, 200); // 2 credits
Expand Down Expand Up @@ -462,7 +462,7 @@ contract ControllerTest is Test {
}

function test_WithdrawRewardsMultipleTimes() public {
string memory vin = "VIN123";
string memory vin = "5YJSA3H10EFP46509";

// Setup: Generate credits
controller.registerVehicle(driver1, vin);
Expand Down

0 comments on commit cb9d28e

Please sign in to comment.