Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
echo "Suma de 5 + 3 = " . $calc->sumar(5, 3) . "\n";
echo "Resta de 10 - 4 = " . $calc->restar(10, 4) . "\n";
echo "Multiplicación de 5 * 3 = " . $calc->multiplicar(5, 3) . "\n";
echo "División de 40 / 4 = " . $calc->dividir(40,4) . "\n";
4 changes: 4 additions & 0 deletions src/Calculadora.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ public function restar($a, $b) {
public function multiplicar($a, $b) {
return $a * $b;
}

public function dividir($a, $b) {
return $a / $b;
}
}
10 changes: 10 additions & 0 deletions tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
if ($calc->multiplicar(3,4) !== 12) {
echo "❌ Error: 3 x 4 debería ser 12\n";
$errores = true;
} else {
echo "Multiplicación OK\n";
}

// Test 4: Probar la división
if ($calc->dividir(40,4) !== 10) {
echo "❌ Error 40 / 4 debería ser 10\n";
$errores = true;
} else {
echo "División OK\n";
}

// Si hubo errores, avisar a GitHub Actions con un código de salida distinto de 0
Expand Down