Recommended
An introduction to functional programming with Go [redux]
[C++ Korea] Effective Modern C++ Study, Item 27, 29 - 30
Тененёв Анатолий, Boost.Asio в алгоритмической торговле
Алексей Кутумов, C++ без исключений, часть 3
Rambler.iOS #8: Чистые unit-тесты
Clang-tidy: путешествие внутрь AST C++
OpenResty/Lua 70+ Advanced Programming Skills and Optimization tips
Understanding Python decorators
Mission ImpAnsible - NSM at (RobotFrame)work
Koniec testowania na sposób “testerski”. Zmiana paradygmatu testowania oprogr...
More Related Content
An introduction to functional programming with Go [redux]
[C++ Korea] Effective Modern C++ Study, Item 27, 29 - 30
What's hot (19)
Тененёв Анатолий, Boost.Asio в алгоритмической торговле
Алексей Кутумов, C++ без исключений, часть 3
Rambler.iOS #8: Чистые unit-тесты
Clang-tidy: путешествие внутрь AST C++
OpenResty/Lua 70+ Advanced Programming Skills and Optimization tips
Understanding Python decorators
More from Adam Przybyła (7)
Mission ImpAnsible - NSM at (RobotFrame)work
Koniec testowania na sposób “testerski”. Zmiana paradygmatu testowania oprogr...
Aby wąż giętki robił to co wymyśli głowa, czyli słów kilka o analizie leksyk...
SELinux, czyli zero-zero-day exploits - DWO 2013
Humanista w twoim linuksie
Open Source i nowe technologie, czyli trochę o systemach o dużej niezawodności
Mikstura it20131. Niepraktycznie i nieskładnie
o Test Driven Development
Adam Przybyła <adam@ertel.com.pl>
(Creative Commons cc-by-nd)
Mikstura 2 Lateral Thinking - Rybnik 2013
3. [root@synergia TDD_ANTLR]# cat test_mikstura.py
#! /usr/bin/python
import unittest
class test_moj(unittest.TestCase):
def test_test(self):
self.assertTrue(False)
if __name__ == '__main__':
unittest.main()
[root@synergia TDD_ANTLR]#
5. [root@synergia TDD_ANTLR]# cat test_mikstura.py
#! /usr/bin/python
import unittest
class test_moj(unittest.TestCase):
def test_test(self):
self.assertTrue(True)
if __name__ == '__main__':
unittest.main()
[root@synergia TDD_ANTLR]#
7. #!/usr/bin/python
import unittest
import antlr3
from CSVLexer import CSVLexer
from CSVParser import CSVParser
class test_csv(unittest.TestCase):
def setUp(self):
pass
def test_test(self):
self.assertTrue(True)
def test_lf(self):
parser=parserek("n")
wynik=parser.line()
self.assertFalse(wynik)
def test_crlf(self):
parser=parserek("rn")
wynik=parser.line()
self.assertFalse(wynik)
#@unittest.skip("omijam test")
def test_red(self):
parser=parserek("red")
wynik=parser.pole()
self.assertEqual(wynik,"red")
8. grammar CSV;
Options { language=Python; }
@header {
def test1(s): print "test"
}
line returns [wynik]
scope { wynik2 }
@init { wynik =[]; $line::wynik2=[]; }
: ( (NEWLINE) => NEWLINE
| ( p1=pole {wynik.append(p1) } ( COMMA p1=pole {wynik.append(p1) } )* NEWLINE ) )
{ wynik=$line::wynik2};
COMMA : ( ' '* ',' ' '*) ;
pole returns [wynik1]
@init {
wynik1=""
try:
wyn=$line::wynik2
except IndexError:
wyn=[]
}
: ( p=ZNAWIASEM { wynik1 = $p.text;}
| p=BEZNAWIASU { wynik1 = $p.text;}
| //nic
) {wyn.append(wynik1)};
NEWLINE : 'r'? 'n';
ZNAWIASEM : ('"' ( options {greedy=false;}: . )+ '"')+
{txt = self.getText().strip('"').replace('""','"');self.setText(txt)};
BEZNAWIASU : ~('r' | 'n' | ',' | ' ' | '"')+;
9. #! /usr/bin/python
# -*- coding: UTF-8 -*-
import unittest
from analizator import *
from pobieracz import *
from TDDczysciciel import Lexer
import pobieracz,analizator,warstwa_leksykalna,codecs,TDDczysciciel
class testy_pobierania(unittest.TestCase):
def setUp(self):
pass
def test_dziala(self):
self.assertTrue(True)
def test_nazwy(self):
self.assertTrue(nazwa_ma_ip("dns.ertel.com.pl"))
def test_zlej_nazwy(self):
self.assertFalse(nazwa_ma_ip("dns-45.ertel.com.pl"))
def test_pinga_dziala(self):
self.assertTrue(nazwa_odp_na_ping('127.0.0.1'))
def test_pinga_niedziala(self):
self.assertFalse(nazwa_odp_na_ping('224.0.0.0'))
10. Lateral Thinking
● Wikinomia
● Wikipedia
● Wolna kultura
● Falsyfikacja jako metoda naukowa i metoda testów