aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/list_ut.pyx
diff options
context:
space:
mode:
authorMikhail Borisov <borisov.mikhail@gmail.com>2022-02-10 16:45:40 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:40 +0300
commit5d50718e66d9c037dc587a0211110b7d25a66185 (patch)
treee98df59de24d2ef7c77baed9f41e4875a2fef972 /util/generic/list_ut.pyx
parenta6a92afe03e02795227d2641b49819b687f088f8 (diff)
downloadydb-5d50718e66d9c037dc587a0211110b7d25a66185.tar.gz
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/generic/list_ut.pyx')
-rw-r--r--util/generic/list_ut.pyx254
1 files changed, 127 insertions, 127 deletions
diff --git a/util/generic/list_ut.pyx b/util/generic/list_ut.pyx
index 9ae44c5ffd..129e5bc9b6 100644
--- a/util/generic/list_ut.pyx
+++ b/util/generic/list_ut.pyx
@@ -1,158 +1,158 @@
from util.generic.list cimport TList
-
-import unittest
+
+import unittest
from cython.operator cimport preincrement
-
-
+
+
class TestList(unittest.TestCase):
-
- def test_ctor1(self):
+
+ def test_ctor1(self):
cdef TList[int] tmp = TList[int]()
- self.assertEqual(tmp.size(), 0)
-
- def test_ctor2(self):
+ self.assertEqual(tmp.size(), 0)
+
+ def test_ctor2(self):
cdef TList[int] tmp = TList[int](10, 42)
- self.assertEqual(tmp.size(), 10)
+ self.assertEqual(tmp.size(), 10)
self.assertEqual(tmp.front(), 42)
-
- def test_ctor3(self):
+
+ def test_ctor3(self):
cdef TList[int] tmp = TList[int](10, 42)
cdef TList[int] tmp2 = TList[int](tmp)
- self.assertEqual(tmp2.size(), 10)
+ self.assertEqual(tmp2.size(), 10)
self.assertEqual(tmp2.front(), 42)
-
- def test_operator_assign(self):
+
+ def test_operator_assign(self):
cdef TList[int] tmp2
- tmp2.push_back(1)
- tmp2.push_back(2)
-
+ tmp2.push_back(1)
+ tmp2.push_back(2)
+
cdef TList[int] tmp3
- tmp3.push_back(1)
- tmp3.push_back(3)
-
- tmp3 = tmp2
-
- def test_compare(self):
+ tmp3.push_back(1)
+ tmp3.push_back(3)
+
+ tmp3 = tmp2
+
+ def test_compare(self):
cdef TList[int] tmp1
- tmp1.push_back(1)
- tmp1.push_back(2)
-
+ tmp1.push_back(1)
+ tmp1.push_back(2)
+
cdef TList[int] tmp2
- tmp2.push_back(1)
- tmp2.push_back(2)
-
+ tmp2.push_back(1)
+ tmp2.push_back(2)
+
cdef TList[int] tmp3
- tmp3.push_back(1)
- tmp3.push_back(3)
-
- self.assertTrue(tmp1 == tmp2)
- self.assertTrue(tmp1 != tmp3)
-
- self.assertTrue(tmp1 < tmp3)
- self.assertTrue(tmp1 <= tmp3)
-
- self.assertTrue(tmp3 > tmp1)
- self.assertTrue(tmp3 >= tmp1)
-
- def test_push_pop_back(self):
+ tmp3.push_back(1)
+ tmp3.push_back(3)
+
+ self.assertTrue(tmp1 == tmp2)
+ self.assertTrue(tmp1 != tmp3)
+
+ self.assertTrue(tmp1 < tmp3)
+ self.assertTrue(tmp1 <= tmp3)
+
+ self.assertTrue(tmp3 > tmp1)
+ self.assertTrue(tmp3 >= tmp1)
+
+ def test_push_pop_back(self):
cdef TList[int] tmp
- self.assertEqual(tmp.size(), 0)
-
- tmp.push_back(42)
- self.assertEqual(tmp.size(), 1)
- self.assertEqual(tmp.back(), 42)
-
- tmp.push_back(77)
- self.assertEqual(tmp.size(), 2)
- self.assertEqual(tmp.back(), 77)
-
- tmp.pop_back()
- self.assertEqual(tmp.size(), 1)
- self.assertEqual(tmp.back(), 42)
-
- tmp.pop_back()
- self.assertEqual(tmp.size(), 0)
-
- def test_front(self):
+ self.assertEqual(tmp.size(), 0)
+
+ tmp.push_back(42)
+ self.assertEqual(tmp.size(), 1)
+ self.assertEqual(tmp.back(), 42)
+
+ tmp.push_back(77)
+ self.assertEqual(tmp.size(), 2)
+ self.assertEqual(tmp.back(), 77)
+
+ tmp.pop_back()
+ self.assertEqual(tmp.size(), 1)
+ self.assertEqual(tmp.back(), 42)
+
+ tmp.pop_back()
+ self.assertEqual(tmp.size(), 0)
+
+ def test_front(self):
cdef TList[int] tmp
- tmp.push_back(42)
- self.assertEqual(tmp.front(), 42)
-
- def test_empty(self):
+ tmp.push_back(42)
+ self.assertEqual(tmp.front(), 42)
+
+ def test_empty(self):
cdef TList[int] tmp
- self.assertTrue(tmp.empty())
- tmp.push_back(42)
- self.assertFalse(tmp.empty())
-
- def test_max_size(self):
+ self.assertTrue(tmp.empty())
+ tmp.push_back(42)
+ self.assertFalse(tmp.empty())
+
+ def test_max_size(self):
cdef TList[int] tmp
- self.assertTrue(tmp.max_size() > 0)
-
+ self.assertTrue(tmp.max_size() > 0)
+
def test_resize(self):
cdef TList[int] tmp
-
- tmp.resize(100, 42)
- self.assertEqual(tmp.size(), 100)
- self.assertEqual(tmp.front(), 42)
- self.assertEqual(tmp.back(), 42)
-
- def test_iter(self):
+
+ tmp.resize(100, 42)
+ self.assertEqual(tmp.size(), 100)
+ self.assertEqual(tmp.front(), 42)
+ self.assertEqual(tmp.back(), 42)
+
+ def test_iter(self):
cdef TList[int] tmp
- tmp.push_back(1)
- tmp.push_back(20)
- tmp.push_back(300)
-
- self.assertEqual([i for i in tmp], [1, 20, 300])
-
- def test_iterator(self):
+ tmp.push_back(1)
+ tmp.push_back(20)
+ tmp.push_back(300)
+
+ self.assertEqual([i for i in tmp], [1, 20, 300])
+
+ def test_iterator(self):
cdef TList[int] tmp
-
- self.assertTrue(tmp.begin() == tmp.end())
- self.assertTrue(tmp.rbegin() == tmp.rend())
- self.assertTrue(tmp.const_begin() == tmp.const_end())
- self.assertTrue(tmp.const_rbegin() == tmp.const_rend())
-
- tmp.push_back(1)
-
- self.assertTrue(tmp.begin() != tmp.end())
- self.assertTrue(tmp.rbegin() != tmp.rend())
- self.assertTrue(tmp.const_begin() != tmp.const_end())
- self.assertTrue(tmp.const_rbegin() != tmp.const_rend())
-
+
+ self.assertTrue(tmp.begin() == tmp.end())
+ self.assertTrue(tmp.rbegin() == tmp.rend())
+ self.assertTrue(tmp.const_begin() == tmp.const_end())
+ self.assertTrue(tmp.const_rbegin() == tmp.const_rend())
+
+ tmp.push_back(1)
+
+ self.assertTrue(tmp.begin() != tmp.end())
+ self.assertTrue(tmp.rbegin() != tmp.rend())
+ self.assertTrue(tmp.const_begin() != tmp.const_end())
+ self.assertTrue(tmp.const_rbegin() != tmp.const_rend())
+
self.assertTrue(preincrement(tmp.begin()) == tmp.end())
self.assertTrue(preincrement(tmp.rbegin()) == tmp.rend())
self.assertTrue(preincrement(tmp.const_begin()) == tmp.const_end())
self.assertTrue(preincrement(tmp.const_rbegin()) == tmp.const_rend())
-
- def test_assign(self):
+
+ def test_assign(self):
cdef TList[int] tmp
-
- tmp.assign(10, 42)
- self.assertEqual(tmp.size(), 10)
- self.assertEqual(tmp.front(), 42)
- self.assertEqual(tmp.back(), 42)
-
- def test_insert(self):
+
+ tmp.assign(10, 42)
+ self.assertEqual(tmp.size(), 10)
+ self.assertEqual(tmp.front(), 42)
+ self.assertEqual(tmp.back(), 42)
+
+ def test_insert(self):
cdef TList[int] tmp
- tmp.push_back(1)
- tmp.push_back(2)
- tmp.push_back(3)
-
- tmp.insert(tmp.begin(), 8)
- self.assertEqual([i for i in tmp], [8, 1, 2, 3])
-
- tmp.insert(tmp.begin(), 2, 6)
- self.assertEqual([i for i in tmp], [6, 6, 8, 1, 2, 3])
-
- def test_erase(self):
+ tmp.push_back(1)
+ tmp.push_back(2)
+ tmp.push_back(3)
+
+ tmp.insert(tmp.begin(), 8)
+ self.assertEqual([i for i in tmp], [8, 1, 2, 3])
+
+ tmp.insert(tmp.begin(), 2, 6)
+ self.assertEqual([i for i in tmp], [6, 6, 8, 1, 2, 3])
+
+ def test_erase(self):
cdef TList[int] tmp
- tmp.push_back(1)
- tmp.push_back(2)
- tmp.push_back(3)
- tmp.push_back(4)
-
+ tmp.push_back(1)
+ tmp.push_back(2)
+ tmp.push_back(3)
+ tmp.push_back(4)
+
tmp.erase(preincrement(tmp.begin()))
- self.assertEqual([i for i in tmp], [1, 3, 4])
-
+ self.assertEqual([i for i in tmp], [1, 3, 4])
+
tmp.erase(tmp.begin(), preincrement(preincrement(tmp.begin())))
- self.assertEqual([i for i in tmp], [4])
+ self.assertEqual([i for i in tmp], [4])