JaroslawWiosna / regionalizer

How to choose the best capital of a state and regions? Divider into regions, especially for administrative purposes
Mozilla Public License 2.0
2 stars 2 forks source link

Tests for database #39

Closed kermit10000000 closed 7 years ago

kermit10000000 commented 7 years ago

Descripition(grammar guardian - there is missing "i" - Descrption in template)

Tests for database(common rules must be checked for the file + maybe some city/ies data like Warsaw to see correctness


Release affected

I think it should be done but i am not sure if HAS TO for v0.2 or maybe for later versions. waiting for your opinion @JaroslawWiosna


Priority

Same as above


Is there possible contributor who could fix the issue

Yes, I will handle it.


JaroslawWiosna commented 7 years ago

@kermit10000000 It is nice to have it before 0.2.0 release.

kermit10000000 commented 7 years ago

ok, i will work on it then.

kermit10000000 commented 7 years ago

Current scenarios proposed:

  1. each line contains 4 pipe signs ("|") , (additional +4 is because last line is always empty)
  2. Warsaw looks like in the given string (which test if database is not shifted and 5 elements are in decided by us order
  3. There is at least 50 cities on the list(random number, since there over 800 cities, we can put here more). Maybe there are some additional ideas for the test cases?

Current problem: i am not sure what should be path to txt file and also it has problems to find the file: obraz

when this will be answered and solved we will close this issue

kermit10000000 commented 7 years ago

Another weird bug is : obraz

count is part of std...

JaroslawWiosna commented 7 years ago

@kermit10000000 http://www.cplusplus.com/reference/algorithm/count/ example section:

// count algorithm example
#include <iostream>     // std::cout
#include <algorithm>    // std::count
#include <vector>       // std::vector

int main () {
  // counting elements in array:
  int myints[] = {10,20,30,30,20,10,10,20};   // 8 elements
  int mycount = std::count (myints, myints+8, 10);
  std::cout << "10 appears " << mycount << " times.\n";

  // counting elements in container:
  std::vector<int> myvector (myints, myints+8);
  mycount = std::count (myvector.begin(), myvector.end(), 20);
  std::cout << "20 appears " << mycount  << " times.\n";

  return 0;
}

..so #include <algorithm> // std::count is essential here

kermit10000000 commented 7 years ago

Ohh right, i did not move it from code blocks where i was testing to the git files(that is why it worked there)... Thank you for noticing.

kermit10000000 commented 7 years ago

Ok so we are back to never ending test: https://travis-ci.org/JaroslawWiosna/regionalizer/builds/288262095 (killed only because of timeout) that i know works(code tested in code blocks with txt attached in proj files) but looks like can not find right txt file with the path given here(the one he finds is somehow infinite)

kermit10000000 commented 7 years ago

I have found that it can be used while( std::getline(cities_data,input)) insted of while(!cities_data.eof()) to fail the test(not get into infinite loop as it stops reading in case of at least one empty line that can not happened in our database). It proves us that file we open is not the one we want to use.

kermit10000000 commented 7 years ago

So far 0 new results, i have tested it with ios::binary, another files name(to check spelling and stuff), checked case of no permission to file(we do have on like 99%), checked case with moving file to the same place as the .cpp file, checked in cmake if we need to add file there, checked different paths. I will continue investigation but I don't promise anything...

kermit10000000 commented 7 years ago

closed by https://github.com/JaroslawWiosna/regionalizer/pull/98