Commit fddb3daf by Szeberényi Imre

v0

parents
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="generikus1" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/generikus1" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/generikus1" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
<Unit filename="alaptipus.hpp" />
<Unit filename="generikus1_teszt.cpp" />
<Unit filename="integer.h" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<DoxyBlocks>
<comment_style block="0" line="0" />
<doxyfile_project />
<doxyfile_build />
<doxyfile_warnings />
<doxyfile_output />
<doxyfile_dot />
<general />
</DoxyBlocks>
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{79C9E9C3-84CB-413A-955A-A97D07617647}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>generikus1</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="integer.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="generikus1_teszt.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="integer.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="generikus1_teszt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
/**
* \file generikus1_teszt.cpp
*
* Egyszerű példa osztálysablonra és függvénysablonra.
*
*/
/**
* TESTLEVEL == 0 estén az előre elkészített Integer osztályt próbálja ki pár esetre.
* TESTLEVEL == 1 estén az Ön által elkészítendő Alaptípus osztálysablont próbálja ki.
* TESTLEVEL >= 2 esetén pedig egy egyszerű függvénysablont kell elkészítenie.
*/
#define TESTLEVEL 0
#include <iostream>
#include "integer.h"
#if TESTLEVEL > 0
# include "alaptipus.hpp"
#endif // TESTLEVEL > 0
/// Korábban használt makró, ami kiírja a paramétereit, majd változtatás nélkül kigenerálja azokat.
/// A kiírást egy tabulátorral kezdi és soremeléssel zárja.
/// Használatával elérhető, hogy a paraméterként adott utasítások, deklarációk a végrehajtás előtt
/// kiíródjanak a képernyőre. Így hatásuk jól megfigyelhető.
#define _(...) std::cout << "\t" << #__VA_ARGS__ << std::endl; __VA_ARGS__
/// Ebből a függvényből kell sablont készíteni TESTLEVEL >= 2 esetén (l. útmutató)
void kiir(Integer* first, Integer* last, std::ostream& os = std::cout) {
while (first != last)
os << *first++ << ' ';
os << std::endl;
}
int main() {
#if TESTLEVEL >= 0
{ // blokk kezdete így a nevek lokálisak maradnak
std::cout << "\nTESTLEVEL >= 0\n";
/// Csak az Integer osztályt mutatja be.
/// Értse meg az osztály működését és használatát!
_( Integer a; )
_( a = 10; )
/// Szedje szét a kifejezést operátoronként külön sorba és
/// a debug funkcióval kövesse a végrehajtást!
_( Integer b = a * 2 + 1 * a + 1; )
/// Néhány további művelet
_( std::cout << b / 10 << std::endl; )
/// Címképzés is megy:
_( int *p = &a; )
_( *p = 13; )
_( std::cout << a << std::endl; )
/// Konstanssal is megy?:
_( const Integer a0; )
_( const int *p0 = &a0; )
_( std::cout << *p0 << std::endl; )
/// Akkor tömböt is tudunk létrehozni?
_( Integer t[] = { 1, 2, 4, 8, 10} ; )
_( kiir(t, t+5); )
} // blokk vége
#endif // TESTLEVEL >= 0
#if TESTLEVEL >= 1
{ // blokk kezdete így a nevek lokálisak maradnak
std::cout << "\nTESTLEVEL >= 1\n";
/// Az Alaptípus sablont példányosítjuk double típusra.
_( Alaptipus<double> a; )
_( a = 10; )
_( Alaptipus<double> b = a * 2 + 1 * a + 1; )
/// Néhány további művelet
_( std::cout << b / 10 << std::endl; )
_( Alaptipus<double> t[] = { 1.1, 2.2, 4.4, 8.8};)
#if TESTLEVEL >= 2
std::cout << "\nTESTLEVEL >= 2\n";
_( kiir(t, t+4); )
#endif // TESTLEVEL >= 2
} // blokk vége
#endif // TESTLEVEL >= 1
return 0;
}
/*
* \file integer.h
*/
#ifndef INTEGER_H
#define INTEGER_H
/// Integer osztály.
/// A konverziós operátorok és a C automatikus konverziós szabályai
/// miatt az osztály példányai úgy használhatók mint egy int változó.
class Integer {
int adat;
public:
Integer(int i = 0) :adat(i) {} /// konstruktor és egyben konverziós operátor
operator int&() { return adat; }/// cast
operator int() const { return adat; } /// const cast
int* operator&() { return &adat; }
const int* operator&() const { return &adat; }
virtual ~Integer() {}
};
#endif // INTEGER_H
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="halmaz" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/halmaz" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/halmaz" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
<Unit filename="gtest_lite.h" />
<Unit filename="halmaz_teszt.cpp">
<Option compilerVar="CC" />
</Unit>
<Unit filename="integer.h" />
<Unit filename="myset.hpp" />
<Unit filename="point.h" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
<DoxyBlocks>
<comment_style block="0" line="0" />
<doxyfile_project />
<doxyfile_build />
<doxyfile_warnings />
<doxyfile_output />
<doxyfile_dot />
<general />
</DoxyBlocks>
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9F8010E7-9209-4AC7-8404-06D454EC868B}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>halmaz</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="gtest_lite.h" />
<ClInclude Include="integer.h" />
<ClInclude Include="point.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="halmaz_teszt.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="gtest_lite.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="integer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="point.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="halmaz_teszt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
/*
* \file halmaz_teszt.cpp
*
*/
#define TESTLEVEL 0
/**
* TESTLEVEL == 0 estén az Ön által készített Set sablon létezését teszteli.
* TESTLEVEL == 1 esetén a Set működését teszteli néhány alaptípussal.
* TESTLEVEL >= 2 esetén a Set sablont a Point osztállyal teszteli.
* TESZLEVEL >= 3 esetén az Ön által készített equal sablont teszteli
* TEZSLEVEL == 4 esetén az Ön által készített equal specializációját teszteli
(Point Y koordinátája nem vesz részt a hasonlításban)
*/
#include <iostream>
#include <stdexcept>
#include "gtest_lite.h"
#include "integer.h"
#include "point.h"
#include "myset.hpp"
/// Tagfüggvények létezését tesztelő sablonok generálása nem fontos megértenie
CREATE_Has_(size)
CREATE_Has_(insert)
CREATE_Has_(isElement)
int main() {
GTINIT(std::cin); // Csak C(J)PORTA működéséhez kell
#if TESTLEVEL == 0
/// Csak azt vizsgálja, hogy a sablon példányosítható-e, keletkeznek-e az előírt tagfüggvények,
/// és a keletkezett kód lefordul-e.
//példányosítjuk int-re
Set<int> int_set;
TEST(int, sanity) {
if (!_Has_size<Set<int> >::member)
FAIL() << "== Nincs size tagfuggveny! ==\n";
if (!_Has_insert<Set<int> >::member)
FAIL() << "== Nincs insert tagfuggveny! ==\n";
if (!_Has_isElement<Set<int> >::member)
FAIL() << "== Nincs isElement tagfuggveny! ==\n";
} ENDM
//példányosítjuk char-ra
Set<char> char_set;
TEST(char, sanity) {
if (!_Has_size<Set<char> >::member)
FAIL() << "== Nincs size tagfuggveny! ==\n";
if (!_Has_insert<Set<char> >::member)
FAIL() << "== Nincs insert tagfuggveny! ==\n";
if (!_Has_isElement<Set<char> >::member)
FAIL() << "== Nincs isElement tagfuggveny! ==\n";
} ENDM
#endif // TESTLEVEL == 0
#if TESTLEVEL >= 1
/// insert és isElement tesztelése int-re
TEST(int, insert) {
Set<int> s0;
s0.insert(1);
s0.insert(2);
EXPECT_TRUE(s0.isElement(1)) << "== Betettuk, de nincs benne! ==\n";
EXPECT_TRUE(s0.isElement(2)) << "== Betettuk, de nincs benne! ==\n";
EXPECT_FALSE(s0.isElement(0)) << "== Nem tettuk be, de benne van! ==\n";
EXPECT_EQ((size_t)2, s0.size()) << "== Nem jo meretet! ***\n";
s0.insert(1);
EXPECT_EQ((size_t)2, s0.size()) << "== Azonos elem utan nem jo a meretet! ==\n";
} ENDM
/// kivétel dobás tesztelése int-re
TEST(int, exception) {
Set<int, 1> s0;
EXPECT_NO_THROW(s0.insert(1));
EXPECT_THROW(s0.insert(2), const char*);
} ENDM
/// insert és isElement tesztelése char-ra
TEST(char, insert) {
Set<char> s0;
s0.insert('a');
EXPECT_TRUE(s0.isElement('a'));
EXPECT_FALSE(s0.isElement('b'));
} ENDM
/// insert és isElement tesztelése Integer-re
TEST(Integer, insert) {
Set<Integer> s0;
s0.insert(Integer(1));
EXPECT_TRUE(s0.isElement(Integer(1)));
EXPECT_FALSE(s0.isElement(Integer(120)));
} ENDM
#endif // TESTLEVEL > 1
#if TESTLEVEL >= 2 && TESTLEVEL < 4
TEST(Point, insert) {
Set<Point> s0;
s0.insert(Point(1, 2));
EXPECT_TRUE(s0.isElement(Point(1, 2)));
EXPECT_FALSE(s0.isElement(Point(1)));
EXPECT_FALSE(s0.isElement(Point(100)));
} ENDM
#endif // TESTLEVEL >= 2
#if TESTLEVEL >= 3
TEST(int, equal) {
int a = 1, b = 1;
EXPECT_TRUE(equal(a, b));
EXPECT_FALSE(equal(a, 2));
} ENDM
#endif // TESTLEVEL >=3 && TESTLEVEL < 4
#if TESTLEVEL == 3
TEST(Point, equal) {
Point a, b, c(0,1), d(1,1), e(1,0);
EXPECT_TRUE(equal(a, b));
EXPECT_FALSE(equal(a, c));
EXPECT_FALSE(equal(a, d));
EXPECT_FALSE(equal(a, e));
} ENDM
#endif // TESTLEVEL == 3
#if TESTLEVEL == 4
TEST(Point, Xequal) {
Point a, b, c(0,1), d(1,1), e(1,0);
EXPECT_TRUE(equal(a, b));
EXPECT_TRUE(equal(a, c));
EXPECT_FALSE(equal(a, d));
EXPECT_FALSE(equal(a, e));
} ENDM
#endif // TESTLEVEL == 4
#if TESTLEVEL == 4
TEST(Point, insert) {
Set<Point> s0;
s0.insert(Point(1));
EXPECT_TRUE(s0.isElement(Point(1)));
EXPECT_FALSE(s0.isElement(Point(100)));
} ENDM
#endif // TESTLEVEL == 4
/// Itt a vége
if (TESTLEVEL < 2 && !gtest_lite::test.fail())
FAIL() << "\nLegalabb az elso ket feladatot oldja meg!" << std::endl;
if (TESTLEVEL >= 4 && !gtest_lite::test.fail())
std::cout << "Szuper! Mind kesz" << std::endl;
else
std::cout << "TESTLEVEL = " << TESTLEVEL << std::endl;
GTEND(std::cerr); // Csak C(J)PORTA működéséhez kell
return 0;
}
/*
* \file integer.h
*/
#ifndef INTEGER_H
#define INTEGER_H
/// Integer osztály.
/// A konverziós operátorok és a C automatikus konverziós szabályai
/// miatt az osztály példányai úgy használhatók mint egy int változó.
class Integer {
int adat;
public:
Integer(int i = 0) :adat(i) {} /// konstruktor és egyben konverziós operátor
operator int&() { return adat; }/// cast
operator int() const { return adat; } /// const cast
int* operator&() { return &adat; }
const int* operator&() const { return &adat; }
virtual ~Integer() {}
};
#endif // INTEGER_H
/*
* \file point.h
*
*/
#ifndef POINT_H
#define POINT_H
/// Point osztly
/// Szndkosan egyszer (buta)
class Point {
int x;
int y;
public:
Point(int x = 0, int y = 0) :x(x), y(y) { }
int getX() const { return x; }
int getY() const { return y; }
};
#endif // POINT_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment