mirror of
https://github.com/Lendaia/oe-alga-feladatok.git
synced 2026-04-23 04:16:32 +01:00
ohnooooo
This commit is contained in:
@@ -13,19 +13,18 @@ namespace OE.ALGA.Adatszerkezetek
|
|||||||
{
|
{
|
||||||
T[] tomb;
|
T[] tomb;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
bool ures = true;
|
|
||||||
public TombVerem(int l)
|
public TombVerem(int l)
|
||||||
{
|
{
|
||||||
tomb = new T[l];
|
tomb = new T[l];
|
||||||
}
|
}
|
||||||
public bool Ures
|
public bool Ures
|
||||||
{
|
{
|
||||||
get { return ures; }
|
get { return n == 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public T Felso()
|
public T Felso()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return tomb[n - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Verembe(T ertek)
|
public void Verembe(T ertek)
|
||||||
@@ -34,7 +33,6 @@ namespace OE.ALGA.Adatszerkezetek
|
|||||||
{
|
{
|
||||||
tomb[n] = ertek;
|
tomb[n] = ertek;
|
||||||
n++;
|
n++;
|
||||||
ures = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -44,22 +42,23 @@ namespace OE.ALGA.Adatszerkezetek
|
|||||||
|
|
||||||
public T Verembol()
|
public T Verembol()
|
||||||
{
|
{
|
||||||
for (int i = tomb.Length; i > 0; i--)
|
if (Ures)
|
||||||
{
|
{
|
||||||
if (tomb[i] != null)
|
throw new NincsElemKivetel();
|
||||||
{
|
|
||||||
return tomb[i];//should i actually delete it, or we are just courious whats the valueidk
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ures = true;
|
else
|
||||||
throw new NincsElemKivetel();
|
{
|
||||||
|
T ertek = tomb[n - 1];
|
||||||
|
n--;
|
||||||
|
return ertek;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class TombSor<T> : Sor<T>
|
public class TombSor<T> : Sor<T>
|
||||||
{
|
{
|
||||||
T[] tomb;
|
T[] tomb;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
bool ures = true;
|
|
||||||
public TombSor(int l)
|
public TombSor(int l)
|
||||||
{
|
{
|
||||||
tomb = new T[l];
|
tomb = new T[l];
|
||||||
@@ -67,7 +66,7 @@ namespace OE.ALGA.Adatszerkezetek
|
|||||||
|
|
||||||
public bool Ures
|
public bool Ures
|
||||||
{
|
{
|
||||||
get { return ures; }
|
get { return n == 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public T Elso()
|
public T Elso()
|
||||||
@@ -81,7 +80,6 @@ namespace OE.ALGA.Adatszerkezetek
|
|||||||
{
|
{
|
||||||
tomb[n] = ertek;
|
tomb[n] = ertek;
|
||||||
n++;
|
n++;
|
||||||
ures = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -91,24 +89,31 @@ namespace OE.ALGA.Adatszerkezetek
|
|||||||
|
|
||||||
public T Sorbol()
|
public T Sorbol()
|
||||||
{
|
{
|
||||||
for (int i = tomb.Length; i > 0; i--)
|
if (Ures)
|
||||||
{
|
{
|
||||||
if (tomb[i] != null)
|
throw new NincsElemKivetel();
|
||||||
{
|
}
|
||||||
return tomb[i];//should i actually delete it, or we are just courious whats the valueidk
|
else
|
||||||
}
|
{
|
||||||
|
T ertek = tomb[0];
|
||||||
|
T[] tmp = new T[tomb.Length];
|
||||||
|
n--;
|
||||||
|
for (int i = 1; i < tomb.Length; i++)
|
||||||
|
{
|
||||||
|
tmp[i - 1] = tomb[i];
|
||||||
|
}
|
||||||
|
tomb = tmp;
|
||||||
|
return ertek;
|
||||||
}
|
}
|
||||||
ures = true;
|
|
||||||
throw new NincsElemKivetel();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class TombLista<T> : Lista<T>, IEnumerable<T>
|
public class TombLista<T> : Lista<T>, IEnumerable<T>
|
||||||
{
|
{
|
||||||
T[] tomb;
|
T[] tomb;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
public TombLista(int l)
|
public TombLista()
|
||||||
{
|
{
|
||||||
tomb = new T[l];
|
tomb = new T[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Elemszam
|
public int Elemszam
|
||||||
@@ -123,29 +128,32 @@ namespace OE.ALGA.Adatszerkezetek
|
|||||||
|
|
||||||
public void Beszur(int index, T ertek)
|
public void Beszur(int index, T ertek)
|
||||||
{
|
{
|
||||||
if (index < 0)
|
if (index < 0 || index > tomb.Length)
|
||||||
{
|
{
|
||||||
throw new HibasIndexKivetel();
|
throw new HibasIndexKivetel();
|
||||||
}
|
}
|
||||||
if (index < tomb.Length && tomb[index] == null)
|
|
||||||
{
|
|
||||||
tomb[index] = ertek;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
T[] tmp = new T[tomb.Length * 2];
|
if (index < tomb.Length && tomb[index] == null)
|
||||||
for (int i = 0; i < index; i++)
|
|
||||||
{
|
{
|
||||||
tmp[i] = tomb[i];
|
tomb[index] = ertek;
|
||||||
}
|
}
|
||||||
tmp[index] = ertek;
|
else
|
||||||
for (int i = index+1; i < tomb.Length; i++)
|
|
||||||
{
|
{
|
||||||
tmp[i] = tomb[i];
|
T[] tmp = new T[tomb.Length * 2];
|
||||||
|
for (int i = 0; i < index; i++)
|
||||||
|
{
|
||||||
|
tmp[i] = tomb[i];
|
||||||
|
}
|
||||||
|
tmp[index] = ertek;
|
||||||
|
for (int i = index + 1; i < tomb.Length; i++)
|
||||||
|
{
|
||||||
|
tmp[i] = tomb[i - 1];
|
||||||
|
}
|
||||||
|
tomb = tmp;
|
||||||
}
|
}
|
||||||
tomb = tmp;
|
n++;
|
||||||
}
|
}
|
||||||
n++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator<T> GetEnumerator()
|
public IEnumerator<T> GetEnumerator()
|
||||||
@@ -163,7 +171,7 @@ namespace OE.ALGA.Adatszerkezetek
|
|||||||
{
|
{
|
||||||
if (n < tomb.Length)
|
if (n < tomb.Length)
|
||||||
{
|
{
|
||||||
tomb[n] = ertek;
|
tomb[n-1] = ertek;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -172,7 +180,7 @@ namespace OE.ALGA.Adatszerkezetek
|
|||||||
{
|
{
|
||||||
tmp[i] = tomb[i];
|
tmp[i] = tomb[i];
|
||||||
}
|
}
|
||||||
tmp[n] = ertek;
|
tmp[n-1] = ertek;
|
||||||
tomb = tmp;
|
tomb = tmp;
|
||||||
}
|
}
|
||||||
n++;
|
n++;
|
||||||
@@ -215,7 +223,7 @@ namespace OE.ALGA.Adatszerkezetek
|
|||||||
T[] tmp = new T[tomb.Length];
|
T[] tmp = new T[tomb.Length];
|
||||||
for (int i = tomb.Length; i > 0; i--)
|
for (int i = tomb.Length; i > 0; i--)
|
||||||
{
|
{
|
||||||
if (i > n)//(ertek == tomb[i])
|
if (ertek.Equals(tomb[i]))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,399 +1,399 @@
|
|||||||
//using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
//using OE.ALGA.Adatszerkezetek;
|
using OE.ALGA.Adatszerkezetek;
|
||||||
|
|
||||||
//namespace OE.ALGA.Tesztek.Adatszerkezetek
|
namespace OE.ALGA.Tesztek.Adatszerkezetek
|
||||||
//{
|
{
|
||||||
// [TestFixture(Category = "Adatszerkezetek", TestName = "03 - Tömb Lista Tesztek")]
|
[TestFixture(Category = "Adatszerkezetek", TestName = "03 - Tömb Lista Tesztek")]
|
||||||
// public class TombListaTesztek
|
public class TombListaTesztek
|
||||||
// {
|
{
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void Elemszam()
|
public void Elemszam()
|
||||||
// {
|
{
|
||||||
// Lista<string> l = new TombLista<string>();
|
Lista<string> l = new TombLista<string>();
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(0));
|
Assert.That(l.Elemszam, Is.EqualTo(0));
|
||||||
// l.Hozzafuz("A");
|
l.Hozzafuz("A");
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(1));
|
Assert.That(l.Elemszam, Is.EqualTo(1));
|
||||||
// l.Hozzafuz("B");
|
l.Hozzafuz("B");
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(2));
|
Assert.That(l.Elemszam, Is.EqualTo(2));
|
||||||
// l.Torol("A");
|
l.Torol("A");
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(1));
|
Assert.That(l.Elemszam, Is.EqualTo(1));
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void Bejaras()
|
public void Bejaras()
|
||||||
// {
|
{
|
||||||
// Lista<int> l = new TombLista<int>();
|
Lista<int> l = new TombLista<int>();
|
||||||
// l.Hozzafuz(1);
|
l.Hozzafuz(1);
|
||||||
// l.Hozzafuz(3);
|
l.Hozzafuz(3);
|
||||||
// l.Hozzafuz(2);
|
l.Hozzafuz(2);
|
||||||
// string s = "";
|
string s = "";
|
||||||
// l.Bejar(x => { Guardian.Recursion.CheckStackTrace(); s += x.ToString(); });
|
l.Bejar(x => { Guardian.Recursion.CheckStackTrace(); s += x.ToString(); });
|
||||||
// Assert.That(s, Is.EqualTo("132"));
|
Assert.That(s, Is.EqualTo("132"));
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void Beszuras()
|
public void Beszuras()
|
||||||
// {
|
{
|
||||||
// Lista<int> l = new TombLista<int>();
|
Lista<int> l = new TombLista<int>();
|
||||||
// l.Beszur(0, 1);
|
l.Beszur(0, 1);
|
||||||
// l.Beszur(0, 2);
|
l.Beszur(0, 2);
|
||||||
// l.Beszur(1, 3);
|
l.Beszur(1, 3);
|
||||||
// l.Beszur(3, 4);
|
l.Beszur(3, 4);
|
||||||
// l.Beszur(2, 5);
|
l.Beszur(2, 5);
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(l.Kiolvas(0), Is.EqualTo(2));
|
Assert.That(l.Kiolvas(0), Is.EqualTo(2));
|
||||||
// Assert.That(l.Kiolvas(1), Is.EqualTo(3));
|
Assert.That(l.Kiolvas(1), Is.EqualTo(3));
|
||||||
// Assert.That(l.Kiolvas(2), Is.EqualTo(5));
|
Assert.That(l.Kiolvas(2), Is.EqualTo(5));
|
||||||
// Assert.That(l.Kiolvas(3), Is.EqualTo(1));
|
Assert.That(l.Kiolvas(3), Is.EqualTo(1));
|
||||||
// Assert.That(l.Kiolvas(4), Is.EqualTo(4));
|
Assert.That(l.Kiolvas(4), Is.EqualTo(4));
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void BeszurasUres()
|
public void BeszurasUres()
|
||||||
// {
|
{
|
||||||
// Lista<string> l = new TombLista<string>();
|
Lista<string> l = new TombLista<string>();
|
||||||
// l.Beszur(0, "1");
|
l.Beszur(0, "1");
|
||||||
// l.Beszur(0, "2");
|
l.Beszur(0, "2");
|
||||||
// l.Beszur(1, "");
|
l.Beszur(1, "");
|
||||||
// l.Beszur(3, "");
|
l.Beszur(3, "");
|
||||||
// l.Beszur(2, "5");
|
l.Beszur(2, "5");
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(l.Kiolvas(0), Is.EqualTo("2"));
|
Assert.That(l.Kiolvas(0), Is.EqualTo("2"));
|
||||||
// Assert.That(l.Kiolvas(1), Is.EqualTo(""));
|
Assert.That(l.Kiolvas(1), Is.EqualTo(""));
|
||||||
// Assert.That(l.Kiolvas(2), Is.EqualTo("5"));
|
Assert.That(l.Kiolvas(2), Is.EqualTo("5"));
|
||||||
// Assert.That(l.Kiolvas(3), Is.EqualTo("1"));
|
Assert.That(l.Kiolvas(3), Is.EqualTo("1"));
|
||||||
// Assert.That(l.Kiolvas(4), Is.EqualTo(""));
|
Assert.That(l.Kiolvas(4), Is.EqualTo(""));
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void HozzaFuzes()
|
public void HozzaFuzes()
|
||||||
// {
|
{
|
||||||
// Lista<int> l = new TombLista<int>();
|
Lista<int> l = new TombLista<int>();
|
||||||
// l.Hozzafuz(1);
|
l.Hozzafuz(1);
|
||||||
// l.Hozzafuz(3);
|
l.Hozzafuz(3);
|
||||||
// l.Hozzafuz(2);
|
l.Hozzafuz(2);
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(l.Kiolvas(0), Is.EqualTo(1));
|
Assert.That(l.Kiolvas(0), Is.EqualTo(1));
|
||||||
// Assert.That(l.Kiolvas(1), Is.EqualTo(3));
|
Assert.That(l.Kiolvas(1), Is.EqualTo(3));
|
||||||
// Assert.That(l.Kiolvas(2), Is.EqualTo(2));
|
Assert.That(l.Kiolvas(2), Is.EqualTo(2));
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void HozzaFuzesUres()
|
public void HozzaFuzesUres()
|
||||||
// {
|
{
|
||||||
// Lista<string> l = new TombLista<string>();
|
Lista<string> l = new TombLista<string>();
|
||||||
// l.Hozzafuz("1");
|
l.Hozzafuz("1");
|
||||||
// l.Hozzafuz("");
|
l.Hozzafuz("");
|
||||||
// l.Hozzafuz("");
|
l.Hozzafuz("");
|
||||||
// l.Hozzafuz("1");
|
l.Hozzafuz("1");
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(l.Kiolvas(0), Is.EqualTo("1"));
|
Assert.That(l.Kiolvas(0), Is.EqualTo("1"));
|
||||||
// Assert.That(l.Kiolvas(1), Is.EqualTo(""));
|
Assert.That(l.Kiolvas(1), Is.EqualTo(""));
|
||||||
// Assert.That(l.Kiolvas(2), Is.EqualTo(""));
|
Assert.That(l.Kiolvas(2), Is.EqualTo(""));
|
||||||
// Assert.That(l.Kiolvas(3), Is.EqualTo("1"));
|
Assert.That(l.Kiolvas(3), Is.EqualTo("1"));
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void Novekedes()
|
public void Novekedes()
|
||||||
// {
|
{
|
||||||
// Lista<int> l = new TombLista<int>();
|
Lista<int> l = new TombLista<int>();
|
||||||
// for (int i = 0; i < 1000; i++)
|
for (int i = 0; i < 1000; i++)
|
||||||
// l.Hozzafuz(i * i);
|
l.Hozzafuz(i * i);
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(1000));
|
Assert.That(l.Elemszam, Is.EqualTo(1000));
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// for (int i = 0; i < 1000; i++)
|
for (int i = 0; i < 1000; i++)
|
||||||
// Assert.That(l.Kiolvas(i), Is.EqualTo(i * i));
|
Assert.That(l.Kiolvas(i), Is.EqualTo(i * i));
|
||||||
// });
|
});
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(1000));
|
Assert.That(l.Elemszam, Is.EqualTo(1000));
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void Torles()
|
public void Torles()
|
||||||
// {
|
{
|
||||||
// Lista<int> l = new TombLista<int>();
|
Lista<int> l = new TombLista<int>();
|
||||||
// l.Hozzafuz(1);
|
l.Hozzafuz(1);
|
||||||
// l.Hozzafuz(3);
|
l.Hozzafuz(3);
|
||||||
// l.Hozzafuz(2);
|
l.Hozzafuz(2);
|
||||||
// l.Hozzafuz(3);
|
l.Hozzafuz(3);
|
||||||
// l.Hozzafuz(4);
|
l.Hozzafuz(4);
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(5));
|
Assert.That(l.Elemszam, Is.EqualTo(5));
|
||||||
// l.Torol(3);
|
l.Torol(3);
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(3));
|
Assert.That(l.Elemszam, Is.EqualTo(3));
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(l.Kiolvas(0), Is.EqualTo(1));
|
Assert.That(l.Kiolvas(0), Is.EqualTo(1));
|
||||||
// Assert.That(l.Kiolvas(1), Is.EqualTo(2));
|
Assert.That(l.Kiolvas(1), Is.EqualTo(2));
|
||||||
// Assert.That(l.Kiolvas(2), Is.EqualTo(4));
|
Assert.That(l.Kiolvas(2), Is.EqualTo(4));
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void TorlesNincsElem()
|
public void TorlesNincsElem()
|
||||||
// {
|
{
|
||||||
// Lista<int> l = new TombLista<int>();
|
Lista<int> l = new TombLista<int>();
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(0));
|
Assert.That(l.Elemszam, Is.EqualTo(0));
|
||||||
// l.Torol(0);
|
l.Torol(0);
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(0));
|
Assert.That(l.Elemszam, Is.EqualTo(0));
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void TorlesUres()
|
public void TorlesUres()
|
||||||
// {
|
{
|
||||||
// Lista<string> l = new TombLista<string>();
|
Lista<string> l = new TombLista<string>();
|
||||||
// l.Hozzafuz("1");
|
l.Hozzafuz("1");
|
||||||
// l.Hozzafuz("");
|
l.Hozzafuz("");
|
||||||
// l.Hozzafuz("");
|
l.Hozzafuz("");
|
||||||
// l.Hozzafuz("");
|
l.Hozzafuz("");
|
||||||
// l.Hozzafuz("1");
|
l.Hozzafuz("1");
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(5));
|
Assert.That(l.Elemszam, Is.EqualTo(5));
|
||||||
// l.Torol("");
|
l.Torol("");
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(2));
|
Assert.That(l.Elemszam, Is.EqualTo(2));
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(l.Kiolvas(0), Is.EqualTo("1"));
|
Assert.That(l.Kiolvas(0), Is.EqualTo("1"));
|
||||||
// Assert.That(l.Kiolvas(1), Is.EqualTo("1"));
|
Assert.That(l.Kiolvas(1), Is.EqualTo("1"));
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void NemletezoTorles()
|
public void NemletezoTorles()
|
||||||
// {
|
{
|
||||||
// Lista<int> l = new TombLista<int>();
|
Lista<int> l = new TombLista<int>();
|
||||||
// l.Hozzafuz(1);
|
l.Hozzafuz(1);
|
||||||
// l.Hozzafuz(2);
|
l.Hozzafuz(2);
|
||||||
// l.Hozzafuz(3);
|
l.Hozzafuz(3);
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(3));
|
Assert.That(l.Elemszam, Is.EqualTo(3));
|
||||||
// l.Torol(0);
|
l.Torol(0);
|
||||||
// Assert.That(l.Elemszam, Is.EqualTo(3));
|
Assert.That(l.Elemszam, Is.EqualTo(3));
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(l.Kiolvas(0), Is.EqualTo(1));
|
Assert.That(l.Kiolvas(0), Is.EqualTo(1));
|
||||||
// Assert.That(l.Kiolvas(1), Is.EqualTo(2));
|
Assert.That(l.Kiolvas(1), Is.EqualTo(2));
|
||||||
// Assert.That(l.Kiolvas(2), Is.EqualTo(3));
|
Assert.That(l.Kiolvas(2), Is.EqualTo(3));
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void Modositas()
|
public void Modositas()
|
||||||
// {
|
{
|
||||||
// Lista<int> l = new TombLista<int>();
|
Lista<int> l = new TombLista<int>();
|
||||||
// l.Hozzafuz(1);
|
l.Hozzafuz(1);
|
||||||
// l.Hozzafuz(3);
|
l.Hozzafuz(3);
|
||||||
// l.Hozzafuz(2);
|
l.Hozzafuz(2);
|
||||||
// l.Modosit(1, 5);
|
l.Modosit(1, 5);
|
||||||
// l.Modosit(0, 4);
|
l.Modosit(0, 4);
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(l.Kiolvas(0), Is.EqualTo(4));
|
Assert.That(l.Kiolvas(0), Is.EqualTo(4));
|
||||||
// Assert.That(l.Kiolvas(1), Is.EqualTo(5));
|
Assert.That(l.Kiolvas(1), Is.EqualTo(5));
|
||||||
// Assert.That(l.Kiolvas(2), Is.EqualTo(2));
|
Assert.That(l.Kiolvas(2), Is.EqualTo(2));
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void ForeachBejaras()
|
public void ForeachBejaras()
|
||||||
// {
|
{
|
||||||
// TombLista<string> l = new TombLista<string>();
|
TombLista<string> l = new TombLista<string>();
|
||||||
// l.Hozzafuz("a");
|
l.Hozzafuz("a");
|
||||||
// l.Hozzafuz("c");
|
l.Hozzafuz("c");
|
||||||
// l.Hozzafuz("d");
|
l.Hozzafuz("d");
|
||||||
// l.Hozzafuz("b");
|
l.Hozzafuz("b");
|
||||||
// string osszefuzo = "";
|
string osszefuzo = "";
|
||||||
// foreach (string x in l)
|
foreach (string x in l)
|
||||||
// {
|
{
|
||||||
// osszefuzo += x;
|
osszefuzo += x;
|
||||||
// }
|
}
|
||||||
// Assert.That(osszefuzo, Is.EqualTo("acdb"));
|
Assert.That(osszefuzo, Is.EqualTo("acdb"));
|
||||||
// }
|
}
|
||||||
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
// [TestFixture(Category = "Adatszerkezetek", TestName = "03 - Tömb Sor Tesztek")]
|
[TestFixture(Category = "Adatszerkezetek", TestName = "03 - Tömb Sor Tesztek")]
|
||||||
// public class TombSorTesztek
|
public class TombSorTesztek
|
||||||
// {
|
{
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void Ures()
|
public void Ures()
|
||||||
// {
|
{
|
||||||
// Sor<int> s = new TombSor<int>(0);
|
Sor<int> s = new TombSor<int>(0);
|
||||||
// Assert.That(s.Ures, Is.True);
|
Assert.That(s.Ures, Is.True);
|
||||||
// Assert.Throws<NincsHelyKivetel>(() => s.Sorba(1));
|
Assert.Throws<NincsHelyKivetel>(() => s.Sorba(1));
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void AlapMukodes()
|
public void AlapMukodes()
|
||||||
// {
|
{
|
||||||
// Sor<int> s = new TombSor<int>(3);
|
Sor<int> s = new TombSor<int>(3);
|
||||||
// Assert.That(s.Ures, Is.True);
|
Assert.That(s.Ures, Is.True);
|
||||||
// s.Sorba(1);
|
s.Sorba(1);
|
||||||
// Assert.That(s.Ures, Is.False);
|
Assert.That(s.Ures, Is.False);
|
||||||
// s.Sorba(3);
|
s.Sorba(3);
|
||||||
// Assert.That(s.Ures, Is.False);
|
Assert.That(s.Ures, Is.False);
|
||||||
// s.Sorba(2);
|
s.Sorba(2);
|
||||||
// Assert.That(s.Ures, Is.False);
|
Assert.That(s.Ures, Is.False);
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(s.Sorbol(), Is.EqualTo(1));
|
Assert.That(s.Sorbol(), Is.EqualTo(1));
|
||||||
// Assert.That(s.Ures, Is.False);
|
Assert.That(s.Ures, Is.False);
|
||||||
// Assert.That(s.Sorbol(), Is.EqualTo(3));
|
Assert.That(s.Sorbol(), Is.EqualTo(3));
|
||||||
// Assert.That(s.Ures, Is.False);
|
Assert.That(s.Ures, Is.False);
|
||||||
// Assert.That(s.Sorbol(), Is.EqualTo(2));
|
Assert.That(s.Sorbol(), Is.EqualTo(2));
|
||||||
// Assert.That(s.Ures, Is.True);
|
Assert.That(s.Ures, Is.True);
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void UresElem()
|
public void UresElem()
|
||||||
// {
|
{
|
||||||
// Sor<string> s = new TombSor<string>(3);
|
Sor<string> s = new TombSor<string>(3);
|
||||||
// s.Sorba("");
|
s.Sorba("");
|
||||||
// s.Sorba("1");
|
s.Sorba("1");
|
||||||
// s.Sorba("");
|
s.Sorba("");
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(s.Sorbol(), Is.EqualTo(""));
|
Assert.That(s.Sorbol(), Is.EqualTo(""));
|
||||||
// Assert.That(s.Sorbol(), Is.EqualTo("1"));
|
Assert.That(s.Sorbol(), Is.EqualTo("1"));
|
||||||
// Assert.That(s.Sorbol(), Is.EqualTo(""));
|
Assert.That(s.Sorbol(), Is.EqualTo(""));
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void Korbeeres()
|
public void Korbeeres()
|
||||||
// {
|
{
|
||||||
// Sor<int> s = new TombSor<int>(3);
|
Sor<int> s = new TombSor<int>(3);
|
||||||
// s.Sorba(1);
|
s.Sorba(1);
|
||||||
// s.Sorba(3);
|
s.Sorba(3);
|
||||||
// s.Sorba(2);
|
s.Sorba(2);
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(s.Sorbol(), Is.EqualTo(1));
|
Assert.That(s.Sorbol(), Is.EqualTo(1));
|
||||||
// Assert.That(s.Sorbol(), Is.EqualTo(3));
|
Assert.That(s.Sorbol(), Is.EqualTo(3));
|
||||||
// });
|
});
|
||||||
// s.Sorba(4);
|
s.Sorba(4);
|
||||||
// s.Sorba(5);
|
s.Sorba(5);
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(s.Sorbol(), Is.EqualTo(2));
|
Assert.That(s.Sorbol(), Is.EqualTo(2));
|
||||||
// Assert.That(s.Sorbol(), Is.EqualTo(4));
|
Assert.That(s.Sorbol(), Is.EqualTo(4));
|
||||||
// Assert.That(s.Sorbol(), Is.EqualTo(5));
|
Assert.That(s.Sorbol(), Is.EqualTo(5));
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void TulSokElem()
|
public void TulSokElem()
|
||||||
// {
|
{
|
||||||
// Sor<int> s = new TombSor<int>(3);
|
Sor<int> s = new TombSor<int>(3);
|
||||||
// s.Sorba(1);
|
s.Sorba(1);
|
||||||
// s.Sorba(3);
|
s.Sorba(3);
|
||||||
// s.Sorba(2);
|
s.Sorba(2);
|
||||||
// Assert.Throws<NincsHelyKivetel>(() => s.Sorba(4));
|
Assert.Throws<NincsHelyKivetel>(() => s.Sorba(4));
|
||||||
// }
|
}
|
||||||
|
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void TulKevesElem()
|
public void TulKevesElem()
|
||||||
// {
|
{
|
||||||
// Sor<int> s = new TombSor<int>(3);
|
Sor<int> s = new TombSor<int>(3);
|
||||||
// s.Sorba(1);
|
s.Sorba(1);
|
||||||
// s.Sorba(3);
|
s.Sorba(3);
|
||||||
// s.Sorba(2);
|
s.Sorba(2);
|
||||||
// s.Sorbol();
|
s.Sorbol();
|
||||||
// s.Sorbol();
|
s.Sorbol();
|
||||||
// s.Sorbol();
|
s.Sorbol();
|
||||||
// Assert.Throws<NincsElemKivetel>(() => s.Sorbol());
|
Assert.Throws<NincsElemKivetel>(() => s.Sorbol());
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void Elso()
|
public void Elso()
|
||||||
// {
|
{
|
||||||
// Sor<int> s = new TombSor<int>(3);
|
Sor<int> s = new TombSor<int>(3);
|
||||||
// s.Sorba(1);
|
s.Sorba(1);
|
||||||
// s.Sorba(3);
|
s.Sorba(3);
|
||||||
// s.Sorba(2);
|
s.Sorba(2);
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(s.Elso(), Is.EqualTo(1));
|
Assert.That(s.Elso(), Is.EqualTo(1));
|
||||||
// Assert.That(s.Elso(), Is.EqualTo(1));
|
Assert.That(s.Elso(), Is.EqualTo(1));
|
||||||
// });
|
});
|
||||||
// s.Sorbol();
|
s.Sorbol();
|
||||||
// Assert.That(s.Elso(), Is.EqualTo(3));
|
Assert.That(s.Elso(), Is.EqualTo(3));
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// [TestFixture(Category = "Adatszerkezetek", TestName = "03 - Tömb Verem Tesztek")]
|
[TestFixture(Category = "Adatszerkezetek", TestName = "03 - Tömb Verem Tesztek")]
|
||||||
// public class TombVeremTesztek
|
public class TombVeremTesztek
|
||||||
// {
|
{
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void Ures()
|
public void Ures()
|
||||||
// {
|
{
|
||||||
// Verem<int> v = new TombVerem<int>(0);
|
Verem<int> v = new TombVerem<int>(0);
|
||||||
// Assert.That(v.Ures, Is.True);
|
Assert.That(v.Ures, Is.True);
|
||||||
// Assert.Throws<NincsHelyKivetel>(() => v.Verembe(1));
|
Assert.Throws<NincsHelyKivetel>(() => v.Verembe(1));
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void AlapMukodes()
|
public void AlapMukodes()
|
||||||
// {
|
{
|
||||||
// Verem<int> v = new TombVerem<int>(3);
|
Verem<int> v = new TombVerem<int>(3);
|
||||||
// Assert.That(v.Ures, Is.True);
|
Assert.That(v.Ures, Is.True);
|
||||||
// v.Verembe(1);
|
v.Verembe(1);
|
||||||
// Assert.That(v.Ures, Is.False);
|
Assert.That(v.Ures, Is.False);
|
||||||
// v.Verembe(3);
|
v.Verembe(3);
|
||||||
// Assert.That(v.Ures, Is.False);
|
Assert.That(v.Ures, Is.False);
|
||||||
// v.Verembe(2);
|
v.Verembe(2);
|
||||||
// Assert.That(v.Ures, Is.False);
|
Assert.That(v.Ures, Is.False);
|
||||||
// Assert.That(v.Verembol(), Is.EqualTo(2));
|
Assert.That(v.Verembol(), Is.EqualTo(2));
|
||||||
// Assert.That(v.Ures, Is.False);
|
Assert.That(v.Ures, Is.False);
|
||||||
// v.Verembe(4);
|
v.Verembe(4);
|
||||||
// Assert.That(v.Ures, Is.False);
|
Assert.That(v.Ures, Is.False);
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(v.Verembol(), Is.EqualTo(4));
|
Assert.That(v.Verembol(), Is.EqualTo(4));
|
||||||
// Assert.That(v.Ures, Is.False);
|
Assert.That(v.Ures, Is.False);
|
||||||
// Assert.That(v.Verembol(), Is.EqualTo(3));
|
Assert.That(v.Verembol(), Is.EqualTo(3));
|
||||||
// Assert.That(v.Ures, Is.False);
|
Assert.That(v.Ures, Is.False);
|
||||||
// Assert.That(v.Verembol(), Is.EqualTo(1));
|
Assert.That(v.Verembol(), Is.EqualTo(1));
|
||||||
// Assert.That(v.Ures, Is.True);
|
Assert.That(v.Ures, Is.True);
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void UresElem()
|
public void UresElem()
|
||||||
// {
|
{
|
||||||
// Verem<string> v = new TombVerem<string>(3);
|
Verem<string> v = new TombVerem<string>(3);
|
||||||
// v.Verembe("");
|
v.Verembe("");
|
||||||
// v.Verembe("1");
|
v.Verembe("1");
|
||||||
// v.Verembe("");
|
v.Verembe("");
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(v.Verembol(), Is.EqualTo(""));
|
Assert.That(v.Verembol(), Is.EqualTo(""));
|
||||||
// Assert.That(v.Verembol(), Is.EqualTo("1"));
|
Assert.That(v.Verembol(), Is.EqualTo("1"));
|
||||||
// Assert.That(v.Verembol(), Is.EqualTo(""));
|
Assert.That(v.Verembol(), Is.EqualTo(""));
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void TulSokElem()
|
public void TulSokElem()
|
||||||
// {
|
{
|
||||||
// Verem<int> v = new TombVerem<int>(3);
|
Verem<int> v = new TombVerem<int>(3);
|
||||||
// v.Verembe(1);
|
v.Verembe(1);
|
||||||
// v.Verembe(3);
|
v.Verembe(3);
|
||||||
// v.Verembe(2);
|
v.Verembe(2);
|
||||||
// Assert.Throws<NincsHelyKivetel>(() => v.Verembe(4));
|
Assert.Throws<NincsHelyKivetel>(() => v.Verembe(4));
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void TulKevesElem()
|
public void TulKevesElem()
|
||||||
// {
|
{
|
||||||
// Verem<int> v = new TombVerem<int>(3);
|
Verem<int> v = new TombVerem<int>(3);
|
||||||
// v.Verembe(1);
|
v.Verembe(1);
|
||||||
// v.Verembe(3);
|
v.Verembe(3);
|
||||||
// v.Verembe(2);
|
v.Verembe(2);
|
||||||
// v.Verembol();
|
v.Verembol();
|
||||||
// v.Verembol();
|
v.Verembol();
|
||||||
// v.Verembol();
|
v.Verembol();
|
||||||
// Assert.Throws<NincsElemKivetel>(() => v.Verembol());
|
Assert.Throws<NincsElemKivetel>(() => v.Verembol());
|
||||||
// }
|
}
|
||||||
// [TestCase]
|
[TestCase]
|
||||||
// public void Felso()
|
public void Felso()
|
||||||
// {
|
{
|
||||||
// Verem<int> v = new TombVerem<int>(3);
|
Verem<int> v = new TombVerem<int>(3);
|
||||||
// v.Verembe(1);
|
v.Verembe(1);
|
||||||
// v.Verembe(3);
|
v.Verembe(3);
|
||||||
// v.Verembe(2);
|
v.Verembe(2);
|
||||||
// Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
// {
|
{
|
||||||
// Assert.That(v.Felso(), Is.EqualTo(2));
|
Assert.That(v.Felso(), Is.EqualTo(2));
|
||||||
// Assert.That(v.Felso(), Is.EqualTo(2));
|
Assert.That(v.Felso(), Is.EqualTo(2));
|
||||||
// });
|
});
|
||||||
// v.Verembol();
|
v.Verembol();
|
||||||
// Assert.That(v.Felso(), Is.EqualTo(3));
|
Assert.That(v.Felso(), Is.EqualTo(3));
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
Reference in New Issue
Block a user