fixed tests under gcc
This commit is contained in:
		
							parent
							
								
									2f81e54568
								
							
						
					
					
						commit
						b5eaef81d4
					
				| @ -1,8 +1,17 @@ | |||||||
| CXX	?= g++ | CXX	?= g++ | ||||||
| CXXFLAGS	=  -D_WIN32_WINNT=0x600 -march=native -Wall -Wextra -Wshadow -pedantic -std=c++11 -pthread -Wl,--no-as-needed  -I../include  | CXXFLAGS	=  -D_WIN32_WINNT=0x600 -march=native -Wall -Wextra -Wshadow -pedantic -std=c++11 -pthread -Wl,--no-as-needed  -I../include  | ||||||
|  | LDPFALGS = -pthread | ||||||
|  | 
 | ||||||
|  | CPP_FILES := $(wildcard *.cpp) | ||||||
|  | OBJ_FILES := $(addprefix ./,$(notdir $(CPP_FILES:.cpp=.o))) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | tests: $(OBJ_FILES) | ||||||
|  | 	$(CXX) $(CXXFLAGS) $(LDPFALGS) -o $@ $^ | ||||||
|  | 
 | ||||||
|  | %.o: %.cpp | ||||||
|  | 	g++ $(CXXFLAGS) -c -o $@ $< | ||||||
| 
 | 
 | ||||||
| all: %.cpp |  | ||||||
|     $(CXX) $^ -o tests $(CXXFLAGS) $(CXX_RELEASE_FLAGS)     |  | ||||||
| clean: | clean: | ||||||
| 	rm -f tests *.o logs/*      | 	rm -f tests *.o logs/*      | ||||||
|   |   | ||||||
|  | |||||||
| @ -4,7 +4,7 @@ static std::string file_contents(const std::string& filename) | |||||||
| { | { | ||||||
|     std::ifstream ifs(filename); |     std::ifstream ifs(filename); | ||||||
|     if (!ifs) |     if (!ifs) | ||||||
|         throw std::exception("Failed open file "); |         throw std::runtime_error("Failed open file "); | ||||||
|     return std::string((std::istreambuf_iterator<char>(ifs)), |     return std::string((std::istreambuf_iterator<char>(ifs)), | ||||||
|                        (std::istreambuf_iterator<char>())); |                        (std::istreambuf_iterator<char>())); | ||||||
| 
 | 
 | ||||||
| @ -15,7 +15,7 @@ static std::size_t count_lines(const std::string& filename) | |||||||
| { | { | ||||||
|     std::ifstream ifs(filename); |     std::ifstream ifs(filename); | ||||||
|     if (!ifs) |     if (!ifs) | ||||||
|         throw std::exception("Failed open file "); |         throw std::runtime_error("Failed open file "); | ||||||
| 
 | 
 | ||||||
|     std::string line; |     std::string line; | ||||||
|     size_t counter = 0; |     size_t counter = 0; | ||||||
| @ -28,7 +28,7 @@ std::ifstream::pos_type filesize(const std::string& filename) | |||||||
| { | { | ||||||
|     std::ifstream ifs(filename, std::ifstream::ate | std::ifstream::binary); |     std::ifstream ifs(filename, std::ifstream::ate | std::ifstream::binary); | ||||||
|     if (!ifs) |     if (!ifs) | ||||||
|         throw std::exception("Failed open file "); |         throw std::runtime_error("Failed open file "); | ||||||
| 
 | 
 | ||||||
|     return ifs.tellg(); |     return ifs.tellg(); | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user