Skip to content

Commit

Permalink
fixed broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Jul 7, 2017
1 parent e19bcc7 commit 1710f04
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,18 @@ $(TARGET_DIR)/%.o: %.cpp
libs/gtest:
$(BUILD_DIR)
cd libs/ ;\
wget -O gtest-1.7.0.zip https://googletest.googlecode.com/files/gtest-1.7.0.zip ;\
unzip -q gtest-1.7.0.zip ;\
cd gtest-1.7.0 ;\
rm googletest -rf ;\
rm gtest -rf ;\
git clone https://github.com/google/googletest.git;\
cd googletest/googletest;\
mkdir -p build ;\
cd build ;\
cmake -G"Unix Makefiles" .. ;\
make ;\
ar -r libgtest.a libgtest_main.a
make
mkdir -p libs/gtest/include/gtest
mv libs/gtest-1.7.0/include/gtest/* libs/gtest/include/gtest
mv libs/gtest-1.7.0/build/libgtest.a libs/gtest/
rm libs/gtest-1.7.0.zip
rm -rf libs/gtest-1.7.0
mv libs/googletest/googletest/include/gtest/* libs/gtest/include/gtest
mv libs/googletest/googletest/build/libgtest.a libs/gtest/
rm -rf libs/googletest
## -------------------------------------------------------------------------------------------------
## Clean up the hole mess
clean:
Expand Down
6 changes: 5 additions & 1 deletion include/gda/Conversion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <stdint.h>
#include <vector>
#include <iostream>
#include <limits>
// -------------------------------------------------------------------------------------------------
namespace gda {
// -------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -36,15 +37,18 @@ std::string to_string(const Number& num)
throw NoNumber();
return stream.str();
}

/// string --> number
template<class Number>
Number to_number(const std::string& str)
{
Number num;
int64_t num;
std::istringstream stream(str);
stream >> num;
if (!stream.good() && !stream.eof())
throw NoNumber();
if(num < std::numeric_limits<Number>::min() || std::numeric_limits<Number>::max() < num)
throw NoNumber();
return num;
}
// -------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/fs/Folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Folder::Folder(const string& in_path)
DIR* directory = opendir(path.c_str());
dirent* entry = readdir(directory);
while (entry) {
if (entry->d_type == 8)
if (entry->d_type != DT_DIR)
files.push_back(File(entry->d_name, *this));
else
subDirectories.push_back(entry->d_name);
Expand Down

0 comments on commit 1710f04

Please sign in to comment.