Google Test - Unit
Disabling a Test
Add DISABLED_
prefix to test name
Floating point comparisons
Use EXPECT_FLOAT_EQ
Running the tests
main.cpp
#include <gtest/gtest.h>
#!/bin/bash | |
if [ "$(whoami)" != "root" ]; then | |
echo "Run script as ROOT please. (sudo !!)" | |
exit | |
fi | |
apt-get update -y | |
apt-get install -t stretch -y php7.0-soap | |
apt-get autoremove -y |
function serializeForm(form) | |
{ | |
var elems = form[0].elements; | |
var serialized = [], i, len = elems.length, str = ""; | |
for (i = 0; i < len; i += 1) | |
{ | |
var element = elems[i]; | |
var type = element.type; | |
var name = element.name; |
function botonRisk(points) | |
{ | |
return Math.max(0, (points - 100) * 10 / 50); | |
} | |
function boton() | |
{ | |
$(".composer_rich_textarea").text("!boton"); | |
$(".im_submit_send").trigger('mousedown'); |
var area = 7; | |
// BLUE | |
/*var color = [ | |
0, 220, 220, | |
35, 255, 255 | |
];*/ | |
// YELLOW | |
var color = [ |
Add DISABLED_
prefix to test name
Use EXPECT_FLOAT_EQ
main.cpp
#include <gtest/gtest.h>
Use MOCK_CONST_*
Simply call base constructor with custom params
C++ allows redefining access level on subclasses, so mocks should have everything as PUBLIC
class Loler
#include <iostream> | |
#include <array> | |
#include <vector> | |
#include <tuple> | |
#include <utility> | |
void printNumbers(int x, int y, int z) | |
{ | |
std::cout << x << std::endl; | |
std::cout << y << std::endl; |
template<typename TBase, typename... Types> | |
constexpr auto polymorphic_get(std::variant<Types...>& v) | |
-> std::enable_if_t<(std::is_base_of_v<TBase, Types> && ...), TBase&> | |
{ | |
return *std::visit([](auto& x){ return dynamic_cast<TBase*>(&x); }, v); | |
} |
#include <iostream> | |
#include <vector> | |
#include <string> | |
using namespace std; | |
class SparseVector | |
{ | |
private: | |
std::vector<bool> orderVec; | |
std::vector<int> valueVec; |
#include <iostream> | |
#include <vector> | |
#include <type_traits> | |
#include <tuple> | |
namespace sfinae | |
{ | |
using success = std::true_type; | |
using fail = std::false_type; |