labs-edaf30/lab1/test_editor.cc

23 lines
597 B
C++
Raw Normal View History

2021-10-27 15:15:47 +02:00
#include "editor.h"
#include <iostream>
void test_equals(Editor::size_type x, Editor::size_type y)
{
if(x != y) {
std::cout << "Wrong result: " << x << " != " << y << std::endl;
};
}
int main() {
Editor ed("...(...(...[...]...)...)...{...}...");
std::cout << "editor.size(): " << ed.get_size() << std::endl;
test_equals( ed.find_left_par(15), 11);
test_equals( ed.find_left_par(19), 7);
test_equals( ed.find_left_par(23), 3);
test_equals( ed.find_left_par(31), 27);
test_equals( ed.find_left_par(32), std::string::npos);
std::cout << "test done." << std::endl;
}