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
#ifndef MINI_TEST | |
#define MINI_TEST | |
/* | |
Mini Test for C++ | |
author: Brian J. Cardiff | |
1. Create simple test cases. |
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
class ScopedCache | |
attr_reader :name | |
def initialize(cache, name, options = nil) | |
@cache = cache | |
@name = name | |
@options = options | |
end | |
def read(key) |
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
require 'rexml/document' | |
class SVG | |
def initialize(width, height) | |
@doc = REXML::Document.new | |
@doc << REXML::XMLDecl.new | |
@svg = @doc.add_element 'svg' | |
@svg.add_attribute 'xmlns', 'http://www.w3.org/2000/svg' | |
@svg.add_attribute 'width', width |
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
#ifndef AED2_TESTS_ | |
#define AED2_TESTS_ | |
#include <iostream> | |
#include <sstream> | |
using namespace std; | |
string mt_bool_to_s(bool b) { return b ? "true" : "false"; } | |
#define MT_MAKE_ERROR(lhs, rhs, line) { ostringstream os;os << "error en linea " << (line) << endl;os << " se esperaba: " << (rhs) << endl;os << " se obtuvo: " << (lhs);throw os.str(); } | |
void mt_assert(bool lhs, bool rhs, int line) { if (lhs != rhs) { MT_MAKE_ERROR(mt_bool_to_s(lhs), mt_bool_to_s(rhs), line) } } |
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 "anillo.h" | |
#include "aed2_tests.h" | |
template<typename T> | |
string to_s(const Anillo<T>* a) { | |
ostringstream os; | |
os << *a; | |
return os.str(); | |
} |
NewerOlder