View UserTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// test/Unit/UserTest.php | |
namespace Tests\Unit; | |
use PHPUnit\Framework\TestCase; | |
class Password { | |
protected $password = ""; |
View tests.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tests.cpp | |
#include "whattotest.cpp" | |
#include <gtest/gtest.h> | |
TEST(SquareRootTest, PositiveNos) { | |
ASSERT_EQ(6, squareRoot(36.0)); | |
ASSERT_EQ(18.0, squareRoot(324.0)); | |
ASSERT_EQ(25.4, squareRoot(645.16)); | |
ASSERT_EQ(0, squareRoot(0.0)); | |
} |
View whattotest.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// whattotest.cpp | |
#include <math.h> | |
double squareRoot(const double a) { | |
double b = sqrt(a); | |
if(b != b) { // nan check | |
return -1.0; | |
}else{ | |
return sqrt(a); | |
} |
View CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Se requiere definir una version minima de cmake, por compatibilidad | |
cmake_minimum_required(VERSION 3.22) | |
# Se requiere definir un nombre de proyecto. | |
project("Gtest") | |
# Buscar el paquete GTest | |
find_package(GTest REQUIRED) | |
# Vincular el archivo de salida con el de pruebas | |
add_executable(a.out test.cpp) |
View test_pytest_a09.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def function_rectangle_type(a,b,c): | |
if (a == b) and (b == c): | |
return "Equilatero" | |
elif (a != b) and (b != c): | |
return "Escaleno" | |
else: | |
return "Isoceles" |
View max_number.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
double n1, n2, n3; | |
cout << "Enter three numbers, enter or space between numbers: "; | |
cin >> n1 >> n2 >> n3; | |
View test_pytest_02.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def function_square(a): | |
return a*a | |
def function_square_root(a): | |
return math.sqrt(a) | |
def function_sum(a,b): | |
return a+b |
View test_unit_02.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import math | |
def function_square(a): | |
return a*a | |
def function_square_root(a): | |
return math.sqrt(a) | |
def function_sum(a,b): |
View test_unit_01.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
def function_square(a): | |
return a*a | |
class Test(unittest.TestCase): | |
def test_function_square(self): | |
self.assertEquals(function_square(2),4) | |
#run the program |
View test_pytest_01.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def function_square(a): | |
return a*a | |
def test_function_square(): | |
assert function_square(2) == 5 | |
test_function_square() | |
#Run the file | |
#pytest test_pytest_01.py |
NewerOlder