├── CHANGES ├── CMakeLists.txt ├── CMakeModules ├── AppendCompilerFlags.cmake ├── CheckSSE4_2.cmake ├── Finddivsufsort.cmake └── Finddivsufsort64.cmake ├── COPYING ├── INSTALL ├── README.md ├── VERSION ├── build ├── .gitignore ├── build.sh └── clean.sh ├── examples ├── .gitignore ├── CMakeLists.txt ├── Makefile.cmake ├── cst_bfs_iterator.cpp ├── json2html.cpp ├── louds_tree.cpp ├── maximal_unique_matches.cpp ├── range_minimum_queries.cpp ├── sigir_demo_fm_index.cpp ├── sigir_demo_fm_rmq_index.cpp ├── sigir_demo_visualize_index.cpp └── wt_huff_from_text.cpp ├── gtest-1.6.0 ├── CHANGES ├── CMakeLists.txt ├── CONTRIBUTORS ├── COPYING ├── Makefile.am ├── Makefile.in ├── README ├── aclocal.m4 ├── build-aux │ ├── config.guess │ ├── config.h.in │ ├── config.sub │ ├── depcomp │ ├── install-sh │ ├── ltmain.sh │ └── missing ├── build │ └── .gitignore ├── cmake │ └── internal_utils.cmake ├── codegear │ ├── gtest.cbproj │ ├── gtest.groupproj │ ├── gtest_all.cc │ ├── gtest_link.cc │ ├── gtest_main.cbproj │ └── gtest_unittest.cbproj ├── configure ├── configure.ac ├── fused-src │ └── gtest │ │ ├── gtest-all.cc │ │ ├── gtest.h │ │ └── gtest_main.cc ├── include │ └── gtest │ │ ├── gtest-death-test.h │ │ ├── gtest-message.h │ │ ├── gtest-param-test.h │ │ ├── gtest-param-test.h.pump │ │ ├── gtest-printers.h │ │ ├── gtest-spi.h │ │ ├── gtest-test-part.h │ │ ├── gtest-typed-test.h │ │ ├── gtest.h │ │ ├── gtest_pred_impl.h │ │ ├── gtest_prod.h │ │ └── internal │ │ ├── gtest-death-test-internal.h │ │ ├── gtest-filepath.h │ │ ├── gtest-internal.h │ │ ├── gtest-linked_ptr.h │ │ ├── gtest-param-util-generated.h │ │ ├── gtest-param-util-generated.h.pump │ │ ├── gtest-param-util.h │ │ ├── gtest-port.h │ │ ├── gtest-string.h │ │ ├── gtest-tuple.h │ │ ├── gtest-tuple.h.pump │ │ ├── gtest-type-util.h │ │ └── gtest-type-util.h.pump ├── m4 │ ├── acx_pthread.m4 │ ├── gtest.m4 │ ├── libtool.m4 │ ├── ltoptions.m4 │ ├── ltsugar.m4 │ ├── ltversion.m4 │ └── lt~obsolete.m4 ├── make │ └── Makefile ├── msvc │ ├── gtest-md.sln │ ├── gtest-md.vcproj │ ├── gtest.sln │ ├── gtest.vcproj │ ├── gtest_main-md.vcproj │ ├── gtest_main.vcproj │ ├── gtest_prod_test-md.vcproj │ ├── gtest_prod_test.vcproj │ ├── gtest_unittest-md.vcproj │ └── gtest_unittest.vcproj ├── samples │ ├── prime_tables.h │ ├── sample1.cc │ ├── sample1.h │ ├── sample10_unittest.cc │ ├── sample1_unittest.cc │ ├── sample2.cc │ ├── sample2.h │ ├── sample2_unittest.cc │ ├── sample3-inl.h │ ├── sample3_unittest.cc │ ├── sample4.cc │ ├── sample4.h │ ├── sample4_unittest.cc │ ├── sample5_unittest.cc │ ├── sample6_unittest.cc │ ├── sample7_unittest.cc │ ├── sample8_unittest.cc │ └── sample9_unittest.cc ├── scripts │ ├── fuse_gtest_files.py │ ├── gen_gtest_pred_impl.py │ ├── gtest-config.in │ ├── pump.py │ └── test │ │ └── Makefile ├── src │ ├── gtest-all.cc │ ├── gtest-death-test.cc │ ├── gtest-filepath.cc │ ├── gtest-internal-inl.h │ ├── gtest-port.cc │ ├── gtest-printers.cc │ ├── gtest-test-part.cc │ ├── gtest-typed-test.cc │ ├── gtest.cc │ └── gtest_main.cc ├── test │ ├── gtest-death-test_ex_test.cc │ ├── gtest-death-test_test.cc │ ├── gtest-filepath_test.cc │ ├── gtest-linked_ptr_test.cc │ ├── gtest-listener_test.cc │ ├── gtest-message_test.cc │ ├── gtest-options_test.cc │ ├── gtest-param-test2_test.cc │ ├── gtest-param-test_test.cc │ ├── gtest-param-test_test.h │ ├── gtest-port_test.cc │ ├── gtest-printers_test.cc │ ├── gtest-test-part_test.cc │ ├── gtest-tuple_test.cc │ ├── gtest-typed-test2_test.cc │ ├── gtest-typed-test_test.cc │ ├── gtest-typed-test_test.h │ ├── gtest-unittest-api_test.cc │ ├── gtest_all_test.cc │ ├── gtest_break_on_failure_unittest.py │ ├── gtest_break_on_failure_unittest_.cc │ ├── gtest_catch_exceptions_test.py │ ├── gtest_catch_exceptions_test_.cc │ ├── gtest_color_test.py │ ├── gtest_color_test_.cc │ ├── gtest_env_var_test.py │ ├── gtest_env_var_test_.cc │ ├── gtest_environment_test.cc │ ├── gtest_filter_unittest.py │ ├── gtest_filter_unittest_.cc │ ├── gtest_help_test.py │ ├── gtest_help_test_.cc │ ├── gtest_list_tests_unittest.py │ ├── gtest_list_tests_unittest_.cc │ ├── gtest_main_unittest.cc │ ├── gtest_no_test_unittest.cc │ ├── gtest_output_test.py │ ├── gtest_output_test_.cc │ ├── gtest_output_test_golden_lin.txt │ ├── gtest_pred_impl_unittest.cc │ ├── gtest_prod_test.cc │ ├── gtest_repeat_test.cc │ ├── gtest_shuffle_test.py │ ├── gtest_shuffle_test_.cc │ ├── gtest_sole_header_test.cc │ ├── gtest_stress_test.cc │ ├── gtest_test_utils.py │ ├── gtest_throw_on_failure_ex_test.cc │ ├── gtest_throw_on_failure_test.py │ ├── gtest_throw_on_failure_test_.cc │ ├── gtest_uninitialized_test.py │ ├── gtest_uninitialized_test_.cc │ ├── gtest_unittest.cc │ ├── gtest_xml_outfile1_test_.cc │ ├── gtest_xml_outfile2_test_.cc │ ├── gtest_xml_outfiles_test.py │ ├── gtest_xml_output_unittest.py │ ├── gtest_xml_output_unittest_.cc │ ├── gtest_xml_test_utils.py │ ├── production.cc │ └── production.h └── xcode │ ├── Config │ ├── DebugProject.xcconfig │ ├── FrameworkTarget.xcconfig │ ├── General.xcconfig │ ├── ReleaseProject.xcconfig │ ├── StaticLibraryTarget.xcconfig │ └── TestTarget.xcconfig │ ├── Resources │ └── Info.plist │ ├── Samples │ └── FrameworkSample │ │ ├── Info.plist │ │ ├── WidgetFramework.xcodeproj │ │ └── project.pbxproj │ │ ├── runtests.sh │ │ ├── widget.cc │ │ ├── widget.h │ │ └── widget_test.cc │ ├── Scripts │ ├── runtests.sh │ └── versiongenerate.py │ └── gtest.xcodeproj │ └── project.pbxproj ├── include ├── CMakeLists.txt └── sdsl │ ├── .gitignore │ ├── CMakeLists.txt │ ├── TODO.txt │ ├── algorithms.hpp │ ├── algorithms_for_balanced_parentheses.hpp │ ├── algorithms_for_compressed_suffix_arrays.hpp │ ├── algorithms_for_compressed_suffix_trees.hpp │ ├── algorithms_for_string_matching.hpp │ ├── algorithms_for_suffix_array_construction.hpp.cmake │ ├── bit_vector_interleaved.hpp │ ├── bit_vectors.hpp │ ├── bitmagic.hpp │ ├── bp_support.hpp │ ├── bp_support_g.hpp │ ├── bp_support_gg.hpp │ ├── bp_support_j.hpp │ ├── bp_support_sada.hpp │ ├── bwt_construct.hpp │ ├── coder.hpp │ ├── compatibility.hpp │ ├── config.hpp.cmake │ ├── csa_construct.hpp │ ├── csa_sada.hpp │ ├── csa_sada_theo.hpp │ ├── csa_uncompressed.hpp │ ├── csa_wt.hpp │ ├── cst3_sct3p.hpp │ ├── cst_construct.hpp │ ├── cst_iterators.hpp │ ├── cst_sada.hpp │ ├── cst_sct.hpp │ ├── cst_sct2.hpp │ ├── cst_sct3.hpp │ ├── elias_delta_coder.hpp │ ├── enc_vector.hpp │ ├── enc_vector_dna.hpp │ ├── enc_vector_prac2.hpp │ ├── enc_vector_theo.hpp │ ├── fast_cache.hpp │ ├── fibonacci_coder.hpp │ ├── gap_vector.hpp │ ├── int_vector.hpp │ ├── int_vector_io_wrappers.hpp │ ├── isa_construct.hpp │ ├── iterators.hpp │ ├── lcp.hpp │ ├── lcp_bitcompressed.hpp │ ├── lcp_construct.hpp │ ├── lcp_dac.hpp │ ├── lcp_kurtz.hpp │ ├── lcp_support_sada.hpp │ ├── lcp_support_tree.hpp │ ├── lcp_support_tree2.hpp │ ├── lcp_vlc.hpp │ ├── lcp_wt.hpp │ ├── louds_tree.hpp │ ├── nearest_neighbour_dictionary.hpp │ ├── nn_dict_dynamic.hpp │ ├── rank_support.hpp │ ├── rank_support_jmc.hpp │ ├── rank_support_v.hpp │ ├── rank_support_v5.hpp │ ├── rmq_succinct_sada.hpp │ ├── rmq_succinct_sct.hpp │ ├── rmq_support.hpp │ ├── rmq_support_sparse_table.hpp │ ├── rrr_helper.hpp │ ├── rrr_vector.hpp │ ├── rrr_vector_15.hpp │ ├── sd_vector.hpp │ ├── sdsl_concepts.hpp │ ├── select_support.hpp │ ├── select_support_bs.hpp │ ├── select_support_dummy.hpp │ ├── select_support_mcl.hpp │ ├── sorted_int_stack.hpp │ ├── sorted_multi_stack_support.hpp │ ├── sorted_stack_support.hpp │ ├── structure_tree.hpp │ ├── suffixarray_helper.hpp │ ├── suffixarrays.hpp │ ├── suffixtrees.hpp │ ├── temp_write_read_buffer.hpp │ ├── template_class.hpp │ ├── ternary_coder.hpp │ ├── test_index_performance.hpp │ ├── testutils.hpp │ ├── tikz.hpp │ ├── typedefs.hpp │ ├── uint128_t.hpp │ ├── uint256_t.hpp │ ├── uintx_t.hpp.cmake │ ├── util.hpp │ ├── vectors.hpp │ ├── vlc_vector.hpp │ ├── wavelet_trees.hpp │ ├── wt.hpp │ ├── wt_fixed_block.hpp │ ├── wt_helper.hpp │ ├── wt_huff.hpp │ ├── wt_int.hpp │ ├── wt_rlg.hpp │ ├── wt_rlg8.hpp │ └── wt_rlmn.hpp ├── install.sh ├── lib ├── CMakeLists.txt ├── algorithms.cpp ├── algorithms_for_suffix_array_construction.cpp ├── bitmagic.cpp ├── bwt_construct.cpp ├── csa_uncompressed.cpp ├── elias_delta_coder.cpp ├── fibonacci_coder.cpp ├── isa_construct.cpp ├── lcp_construct.cpp ├── louds_tree.cpp ├── nn_dict_dynamic.cpp ├── select_support_dummy.cpp ├── structure_tree.cpp ├── ternary_coder.cpp ├── test_index_performance.cpp ├── testutils.cpp ├── tikz.cpp └── util.cpp ├── libdivsufsort-2.0.1 ├── AUTHORS ├── CMakeLists.txt ├── CMakeModules │ ├── AppendCompilerFlags.cmake │ ├── CheckFunctionKeywords.cmake │ ├── CheckLFS.cmake │ ├── ProjectCPack.cmake │ └── cmake_uninstall.cmake.in ├── COPYING ├── ChangeLog ├── ChangeLog.old ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── VERSION ├── aclocal.m4 ├── build │ └── .gitignore ├── config │ ├── config.guess │ ├── config.sub │ ├── depcomp │ ├── install-sh │ ├── ltmain.sh │ └── missing ├── configure ├── configure.ac ├── examples │ ├── CMakeLists.txt │ ├── Makefile.am │ ├── Makefile.in │ ├── bwt.c │ ├── mksary.c │ ├── sasearch.c │ ├── suftest.c │ └── unbwt.c ├── include │ ├── CMakeLists.txt │ ├── Makefile.am │ ├── Makefile.in │ ├── config.h.cmake │ ├── config.h.in │ ├── divsufsort.h.cmake │ ├── divsufsort64.h.in │ ├── divsufsort_private.h │ └── lfs.h.cmake ├── lib │ ├── CMakeLists.txt │ ├── Makefile.am │ ├── Makefile.in │ ├── divsufsort.c │ ├── libdivsufsort.sym │ ├── libdivsufsort64.sym │ ├── sssort.c │ ├── trsort.c │ └── utils.c ├── m4 │ ├── libtool.m4 │ ├── ltoptions.m4 │ ├── ltsugar.m4 │ ├── ltversion.m4 │ └── lt~obsolete.m4 └── pkgconfig │ ├── CMakeLists.txt │ └── libdivsufsort.pc.cmake ├── scripts └── download.sh ├── sdsl_definitions.sty └── test ├── .gitignore ├── BitMagicTest.cpp ├── BitVectorTest.cpp ├── CMakeLists.txt ├── CstTest.cpp ├── IntVectorTest.cpp ├── Makefile.cmake ├── README ├── RankSupportTest.cpp ├── SelectSupportTest.cpp ├── SelectSupportTest0.cpp ├── WtAsciiTest.cpp ├── WtIntTest.cpp └── test_cases ├── crafted ├── 100a.txt ├── README ├── abc_abc_abc.txt ├── abc_abc_abc2.txt ├── empty.txt └── example01.txt └── small ├── .gitignore ├── README └── get_corpus.sh /CHANGES: -------------------------------------------------------------------------------- 1 | 2012-02-08: Fixed handling of last block in rrr_vector in the constructor. Bug was discover through 2 | new tests (using gtest) for rank data structures. 3 | 2012-02-04: Moved non-template functions from lcp_constract.hpp and isa_construct.hpp into .cpp files. 4 | Thanks to Matthias Petri to pointing this out. 5 | 2012-01-27: Fixed a problem with compiling the library in C++0x. Thanks to Sebastian Me\ssmer for the patch. 6 | 2012-01-27: Fixed a bug in the Winer link operation of cst_sct* and cst_sada. Thanks to 7 | Kalle Karhu for pointing this out. 8 | 2012-01-25: Fixed some issues with GCC (Version 4.6.1). Thanks to Sebastian Me\ssmer. 9 | 2011-11-30: When the compile your programs with GCC (Version >= 3.4) 10 | and option -msse4.2 and your CPU supports 11 | sse 4.2, then a single instruction is used for the 12 | popcount method (bitmagic::b1Cnt). 13 | 14 | 2011-11-14: Added the template parameter "BitVector" to wt_huff and wt_rlmn. 15 | This may cause compile errors, when you compile code where you have 16 | specified template paramters for wt_huff and wt_rlmn. You should 17 | add the class bit_vector as first template parameter to wt_huff 18 | and wt_rlmn in this cases. 19 | 2011-11-13: Added the class rrr_vector. 20 | 21 | 2011-11-04: Added header cstddef in int_vector for ptrdiff_t 22 | 23 | 24 | From 9.0 to 9.1 25 | - accelerated BWT calculation 26 | - fixed a bug in the construction of int_wavelet_tree 27 | - added new lcp construction method (goPHI) 28 | 29 | From 0.8 to 9.0 30 | - added int_wavelet_tree 31 | - added semi-external construction of csts 32 | - added new lcp construction methods (go, go2) 33 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.0) 2 | set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") 3 | include(AppendCompilerFlags) 4 | include(CheckSSE4_2) 5 | 6 | ## Project information ## 7 | project(sdsl CXX C) 8 | set(PROJECT_VEDOR "Simon Gog") 9 | set(PROJECT_CONTACT "simon.gog@gmail.com") 10 | set(PROJECT_URL "https://github.com/simongog/sdsl") 11 | set(PROJECT_DESCRIPTION "SDSL: Succinct Data Structure Library") 12 | set(CMAKE_BUILD_TYPE "Release") 13 | 14 | ## Project options ## 15 | option(USE_LIBDIVSUFSORT "Use the libdivsufsort library of Yuta Mori to construct suffix arrays" ON) 16 | if(USE_LIBDIVSUFSORT) 17 | find_package(divsufsort) 18 | find_package(divsufsort64) 19 | else() 20 | set( divsufsort_FOUND 0 ) 21 | set( divsufsort64_FOUND 0 ) 22 | endif() 23 | 24 | if(NOT divsufsort_FOUND) 25 | set( divsufsort_INCLUDE_DIRS "." ) 26 | message("WARNING: libdivsufsort is not installed! ") 27 | message(" The build in default algorithm ") 28 | message(" will use much more time and space") 29 | message(" then libdivsufsort!") 30 | endif() 31 | 32 | if(NOT divsufsort64_FOUND) 33 | set( divsufsort64_INCLUDE_DIRS "." ) 34 | message("WARNING: libdivsufsort64 is not installed! ") 35 | message(" The build in default algorithm ") 36 | message(" will use much more time and space") 37 | message(" then libdivsufsort64!") 38 | endif() 39 | 40 | 41 | 42 | file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" PROJECT_VERSION_FULL) 43 | string(REGEX REPLACE "[\n\r]" "" PROJECT_VERSION_FULL "${PROJECT_VERSION_FULL}") 44 | string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+$" "\\1" PROJECT_VERSION_MAJOR "${PROJECT_VERSION_FULL}") 45 | string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+$" "\\1" PROJECT_VERSION_MINOR "${PROJECT_VERSION_FULL}") 46 | string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)$" "\\1" PROJECT_VERSION_PATCH "${PROJECT_VERSION_FULL}") 47 | set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}") 48 | math(EXPR LIBRARY_VERSION_MAJOR "1 + ${PROJECT_VERSION_MAJOR}") 49 | set(LIBRARY_VERSION_MINOR "${PROJECT_VERSION_MINOR}") 50 | set(LIBRARY_VERSION_PATCH "${PROJECT_VERSION_PATCH}") 51 | set(LIBRARY_VERSION "${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}") 52 | set(LIBRARY_VERSION_FULL "${LIBRARY_VERSION}.${LIBRARY_VERSION_PATCH}") 53 | 54 | #append_cxx_compiler_flags("-W -ffast-math -Wall -O9 -funroll-loops -DNDEBUG -DWRITE_R_OUTPUT -DMEM_INFO" "GCC" CMAKE_CXX_FLAGS) 55 | #append_cxx_compiler_flags("-ffast-math -Wall -pedantic -enable-long-long -Weffc++ -O9 -funroll-loops -DNDEBUG -DWRITE_R_OUTPUT -DMEM_INFO" "GCC" CMAKE_CXX_FLAGS) 56 | append_cxx_compiler_flags("-ffast-math -Wall -O9 -funroll-loops -DNDEBUG" "GCC" CMAKE_CXX_FLAGS) 57 | 58 | 59 | if( BUILTIN_POPCNT ) 60 | append_cxx_compiler_flags("-msse4.2" "GCC" CMAKE_CXX_FLAGS) 61 | message("CPU seems to support fast popcount.\n") 62 | message("Flag -msse4.2 added to compile options.\n") 63 | endif() 64 | #append_cxx_compiler_flags("-Wall -ffast-math -Wall -g -DNDEBUG" "GCC" CMAKE_CXX_FLAGS) 65 | 66 | add_subdirectory(include) 67 | add_subdirectory(lib) 68 | add_subdirectory(test) 69 | add_subdirectory(examples) 70 | 71 | message("Options") 72 | message("USE_LIBDIVSUFSORT = ${USE_LIBDIVSUFSORT}") 73 | -------------------------------------------------------------------------------- /CMakeModules/AppendCompilerFlags.cmake: -------------------------------------------------------------------------------- 1 | include(CheckCSourceCompiles) 2 | include(CheckCXXSourceCompiles) 3 | 4 | macro(append_c_compiler_flags _flags _name _result) 5 | set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) 6 | string(REGEX REPLACE "[-+/ ]" "_" cname "${_name}") 7 | string(TOUPPER "${cname}" cname) 8 | foreach(flag ${_flags}) 9 | string(REGEX REPLACE "^[-+/ ]+(.*)[-+/ ]*$" "\\1" flagname "${flag}") 10 | string(REGEX REPLACE "[-+/ ]" "_" flagname "${flagname}") 11 | string(TOUPPER "${flagname}" flagname) 12 | set(have_flag "HAVE_${cname}_${flagname}") 13 | set(CMAKE_REQUIRED_FLAGS "${flag}") 14 | check_c_source_compiles("int main() { return 0; }" ${have_flag}) 15 | if(${have_flag}) 16 | set(${_result} "${${_result}} ${flag}") 17 | endif(${have_flag}) 18 | endforeach(flag) 19 | set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS}) 20 | endmacro(append_c_compiler_flags) 21 | 22 | macro(append_cxx_compiler_flags _flags _name _result) 23 | set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) 24 | string(REGEX REPLACE "[-+/ ]" "_" cname "${_name}") 25 | string(TOUPPER "${cname}" cname) 26 | foreach(flag ${_flags}) 27 | string(REGEX REPLACE "^[-+/ ]+(.*)[-+/ ]*$" "\\1" flagname "${flag}") 28 | string(REGEX REPLACE "[-+/ ]" "_" flagname "${flagname}") 29 | string(TOUPPER "${flagname}" flagname) 30 | set(have_flag "HAVE_${cname}_${flagname}") 31 | set(CMAKE_REQUIRED_FLAGS "${flag}") 32 | check_cxx_source_compiles("int main() { return 0; }" ${have_flag}) 33 | if(${have_flag}) 34 | set(${_result} "${${_result}} ${flag}") 35 | endif(${have_flag}) 36 | endforeach(flag) 37 | set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS}) 38 | endmacro(append_cxx_compiler_flags) 39 | -------------------------------------------------------------------------------- /CMakeModules/CheckSSE4_2.cmake: -------------------------------------------------------------------------------- 1 | # Check if the CPU provides fast operations 2 | # for popcount, leftmost and rightmost bit 3 | 4 | set(BUILTIN_POPCNT 0) 5 | # Check if we are on a Linux system 6 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") 7 | # Use /proc/cpuinfo to get the information 8 | file(STRINGS "/proc/cpuinfo" _cpuinfo) 9 | if(_cpuinfo MATCHES "(sse4_2)|(sse4a)") 10 | set(BUILTIN_POPCNT 1) 11 | message("hey dude, builtin popcnt!") 12 | else() 13 | message("sorry dude, no builtin popcnt") 14 | endif() 15 | elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") 16 | # handle windows 17 | # get_filename_component(_vendor_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;VendorIdentifier]" NAME CACHE) 18 | # get_filename_component(_cpu_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;Identifier]" NAME CACHE) 19 | elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") 20 | # handle MacOs 21 | endif() 22 | 23 | -------------------------------------------------------------------------------- /CMakeModules/Finddivsufsort.cmake: -------------------------------------------------------------------------------- 1 | # find divsufsort library of Yuta Mori 2 | 3 | # search in /usr/local/include and ~/include for divsufsort includes 4 | find_path(divsufsort_INCLUDE_DIRS divsufsort.h /usr/local/include ~/include "$ENV{divsufsort_ROOT}") 5 | # search in /usr/local/lib and ~/lib for divsufsort library 6 | find_library(divsufsort_LIBRARIES divsufsort /usr/local/lib ~/lib "$ENV{divsufsort_ROOT}") 7 | 8 | set(divsufsort_FOUND TRUE) 9 | 10 | if(NOT divsufsort_INCLUDE_DIRS) 11 | set(divsufsort_FOUND FALSE) 12 | endif(NOT divsufsort_INCLUDE_DIRS) 13 | 14 | if(NOT divsufsort_LIBRARIES) 15 | set(divsufsort_FOUND FALSE) 16 | else() 17 | get_filename_component(divsufsort_LIBRARY_DIRS ${divsufsort_LIBRARIES} PATH) 18 | message("FOUND divsufsort library in ${divsufsort_LIBRARY_DIRS}") 19 | endif(NOT divsufsort_LIBRARIES) 20 | -------------------------------------------------------------------------------- /CMakeModules/Finddivsufsort64.cmake: -------------------------------------------------------------------------------- 1 | # find the 64 bit version divsufsort64 2 | 3 | find_path(divsufsort64_INCLUDE_DIRS divsufsort64.h /usr/local/include ~/include "$ENV{divsufsort64_ROOT}") 4 | find_library(divsufsort64_LIBRARIES divsufsort64 /usr/local/lib ~/lib "$ENV{divsufsort64_ROOT}") 5 | 6 | set(divsufsort64_FOUND TRUE) 7 | 8 | if(NOT divsufsort64_INCLUDE_DIRS) 9 | set(divsufsort64_FOUND FALSE) 10 | endif(NOT divsufsort64_INCLUDE_DIRS) 11 | 12 | if(NOT divsufsort64_LIBRARIES) 13 | set(divsufsort64_FOUND FALSE) 14 | else() 15 | get_filename_component(divsufsort64_LIBRARY_DIRS ${divsufsort_LIBRARIES} PATH) 16 | message("FOUND divsufsort library in ${divsufsort64_LIBRARY_DIRS}") 17 | 18 | endif(NOT divsufsort64_LIBRARIES) 19 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | The sdsl copyright is as follows: 2 | 3 | Copyright (C) 2007-2012 Simon Gog All Right Reserved. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see http://www.gnu.org/licenses/ . 17 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | The installation requires the cross-platoform 2 | build-tool cmake to be installed first. 3 | 4 | You can download cmake here: 5 | 6 | http://cmake.org/cmake/resources/software.html 7 | 8 | With cmake installed, the library then can be 9 | installed automatically by running the command 10 | ./install.sh YOUR_SDSL_INSTALL_PREFIX 11 | 12 | YOUR_SDSL_INSTALL_PREFIX should be an absolute 13 | path to an existing directory other then the 14 | directory where this INSTALL file is located in. 15 | 16 | After running the script you can change into 17 | the test directory and make and execute the tests by 18 | make && make test 19 | 20 | Check out also the examples directory. 21 | 22 | You can compile your own program example.cc by 23 | 24 | g++ -O3 -DNDEBUG -funroll-loops -I YOUR_SDSL_INSTALL_PREFIX/include \ 25 | -LYOUR_SDSL_INSTALL_PREFIX/lib -o example example.cc \ 26 | -lsdsl -ldivsufsort -ldivsufsort64 27 | 28 | or you can copy the Makefile from the examples directory 29 | to build you programs using sdsl. 30 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.9.10 2 | -------------------------------------------------------------------------------- /build/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !build.sh 4 | !clean.sh 5 | -------------------------------------------------------------------------------- /build/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | CUR_DIR=`pwd` 3 | OLD_DIR="$( cd "$( dirname "$0" )" && pwd )" # gets the directory where the script is located in 4 | cd "${OLD_DIR}" 5 | 6 | cmake .. -DCMAKE_INSTALL_PREFIX=${HOME} && make install 7 | 8 | cd ${CUR_DIR} 9 | -------------------------------------------------------------------------------- /build/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # activate globbing 3 | shopt -s extglob 4 | # removes all but the listed files in the directory 5 | # and subdirectories 6 | rm -rf !(build.sh|clean.sh|.gitignore) 7 | 8 | -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !*.cpp 3 | !Makefile.cmake 4 | !CMakeLists.txt 5 | !.gitignore 6 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Makefile.cmake" 2 | "${CMAKE_CURRENT_SOURCE_DIR}/Makefile" @ONLY) 3 | -------------------------------------------------------------------------------- /examples/Makefile.cmake: -------------------------------------------------------------------------------- 1 | CC=g++ 2 | CC_FLAGS=-Wall -g -O3 -I@CMAKE_INSTALL_PREFIX@/include -L@CMAKE_INSTALL_PREFIX@/lib -DNDEBUG -funroll-loops -msse4.2 3 | CCLIB=-lsdsl -ldivsufsort -ldivsufsort64 4 | SOURCES=$(wildcard *.cpp) 5 | EXECS=$(SOURCES:.cpp=) 6 | 7 | all: $(EXECS) 8 | 9 | %:%.cpp 10 | $(CC) $(CC_FLAGS) -o $@ $< $(CCLIB) 11 | 12 | clean: 13 | rm -f $(EXECS) 14 | 15 | -------------------------------------------------------------------------------- /examples/cst_bfs_iterator.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | using namespace sdsl; 8 | 9 | 10 | template 11 | void test(string file) 12 | { 13 | std::cout << file << std::endl; 14 | tCst cst; 15 | // util::verbose = true; 16 | construct_cst(file, cst); 17 | 18 | typedef cst_bfs_iterator iterator; 19 | iterator begin = iterator(&cst, cst.root()); 20 | iterator end = iterator(&cst, cst.root(), true, true); 21 | 22 | for (iterator it = begin; it != end; ++it) { 23 | std::cout << cst.depth(*it) << "-[" << cst.lb(*it) << "," << cst.rb(*it) << "]" << std::endl; 24 | } 25 | } 26 | 27 | int main(int argc, char* argv[]) 28 | { 29 | if (argc < 2) { 30 | cout << "usage: "< >(argv[1]); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/louds_tree.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | using namespace sdsl; 9 | 10 | template 11 | void print_tree(const tTree& tree, const tNode& v, int depth, bit_vector& visited) 12 | { 13 | typedef typename tTree::size_type size_type; 14 | if (tree.nodes() < 60) { 15 | for (int i=0; i >(argv[1]); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /examples/range_minimum_queries.cpp: -------------------------------------------------------------------------------- 1 | #include // include header for range minimum queries 2 | #include 3 | #include // for atoi 4 | 5 | using namespace sdsl; 6 | using namespace std; 7 | 8 | int main(int argc, char **argv){ 9 | size_t len = 50; 10 | if( argc > 1 ){ 11 | len = atoi(argv[1]); 12 | } 13 | int_vector<> v(len, 7); // create a vector of length 50 14 | for(size_t i=1; i < v.size(); ++i){ 15 | size_t x = v[i-1]; 16 | v[i] = (x*7-1) % 97; 17 | } 18 | cout << "get_size_in_bytes(v)=" << util::get_size_in_bytes(v) << endl; 19 | 20 | rmq_succinct_sct<> rmq(&v); 21 | cout << "get_size_in_bytes(rmq)/v.size()=" << ((double)util::get_size_in_bytes(rmq))/v.size() << endl; 22 | 23 | if ( v.size() < 100 ) { // if the vector is small 24 | cout << "v = " << v << endl; // output it 25 | } 26 | size_t left = 0, right = v.size()-1; 27 | 28 | // rmq does not need v to answer the queries 29 | util::clear(v); // so we can free the space for v 30 | 31 | size_t count = 0; 32 | 33 | while( left < right ){ 34 | size_t min_pos = rmq(left, right); 35 | if ( ++count < 10 ){ 36 | cout << "minimum of v[" << left << "..." << right << "] at index "; 37 | cout << min_pos << endl; 38 | } 39 | if ( min_pos - left > right - min_pos ){ 40 | right = min_pos - 1; 41 | }else{ 42 | left = min_pos + 1; 43 | } 44 | } 45 | cout << endl; 46 | cout << "Breakdown of the data structure: " << endl; 47 | util::write_structure(rmq, cout); 48 | cout << endl; 49 | } 50 | -------------------------------------------------------------------------------- /examples/sigir_demo_fm_index.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace sdsl; 9 | using namespace std; 10 | 11 | int main(int argc, char **argv){ 12 | if( argc < 2 ){ 13 | cout << "Usage " << argv[0] << " text_file [max_locations] [post_context] [pre_context]" << endl; 14 | cout << " This program constructs a very compact FM-index" << endl; 15 | cout << " which supports count, locate, and extract queries." << endl; 16 | cout << " text_file Original text file." << endl; 17 | cout << " max_locations Maximal number of location to report." <= 3 ){ max_locations = atoi(argv[2]); } 26 | if ( argc >= 4 ){ post_context = atoi(argv[3]); } 27 | if ( argc >= 5 ){ pre_context = atoi(argv[4]); } 28 | string index_suffix = ".fm9"; 29 | string index_file = string(argv[1])+index_suffix; 30 | csa_wt >, 512, 1024> fm_index; 31 | 32 | if( !util::load_from_file(fm_index, index_file.c_str()) ){ 33 | ifstream in(argv[1]); 34 | if( !in ){ cout << "ERROR: File " << argv[1] << " does not exist. Exit." << endl; return 1; } 35 | cout << "No index "< 0 ){ 49 | cout << "Location and context of first occurrences: " << endl; 50 | int_vector<> locations; 51 | algorithm::locate(fm_index, (const unsigned char*)query.c_str(), m, locations); 52 | sort(locations.begin(), locations.end()); 53 | for(size_t i = 0, pre_extract = pre_context, post_extract = post_context; i < min(occs, max_locations); ++i){ 54 | cout << setw(8) << locations[i] << ": "; 55 | if( pre_extract > locations[i] ){ pre_extract = locations[i]; } 56 | if( locations[i]+m+ post_extract > fm_index.size() ){ post_extract = fm_index.size()-locations[i]-m; } 57 | string s = algorithm::extract(fm_index, locations[i]-pre_extract, locations[i]+m+ post_extract-1 ); 58 | string pre = s.substr(0, pre_extract); 59 | s = s.substr(pre_extract); 60 | if( pre.find_last_of('\n') != string::npos ){ pre = pre.substr(pre.find_last_of('\n')+1); } 61 | cout << pre; 62 | cout << "\e[1;31m"; 63 | cout << s.substr(0, m); 64 | cout << "\e[0m"; 65 | string context = s.substr(m); 66 | cout << context.substr(0, context.find_first_of('\n')) << endl; 67 | } 68 | } 69 | cout << prompt; 70 | } 71 | cout << endl; 72 | } 73 | 74 | -------------------------------------------------------------------------------- /examples/wt_huff_from_text.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace sdsl; 5 | using namespace std; 6 | 7 | int main(int argc, char* argv[]) 8 | { 9 | if (argc < 2) { 10 | cout << "usage: "< file_buf; 13 | file_buf.load_from_plain(argv[1]); 14 | wt_huff<> wt(file_buf, file_buf.int_vector_size); 15 | 16 | for (size_t i=0; i 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Hady Zalek 15 | Jeffrey Yasskin 16 | Jói Sigurðsson 17 | Keir Mierle 18 | Keith Ray 19 | Kenton Varda 20 | Manuel Klimek 21 | Markus Heule 22 | Mika Raento 23 | Miklós Fazekas 24 | Pasi Valminen 25 | Patrick Hanna 26 | Patrick Riley 27 | Peter Kaminski 28 | Preston Jackson 29 | Rainer Klaffenboeck 30 | Russ Cox 31 | Russ Rufer 32 | Sean Mcafee 33 | Sigurður Ásgeirsson 34 | Tracy Bialik 35 | Vadim Berman 36 | Vlad Losev 37 | Zhanyong Wan 38 | -------------------------------------------------------------------------------- /gtest-1.6.0/COPYING: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /gtest-1.6.0/build-aux/config.h.in: -------------------------------------------------------------------------------- 1 | /* build-aux/config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_DLFCN_H 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_INTTYPES_H 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_MEMORY_H 11 | 12 | /* Define if you have POSIX threads libraries and header files. */ 13 | #undef HAVE_PTHREAD 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_STDINT_H 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_STDLIB_H 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #undef HAVE_STRINGS_H 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_STRING_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_SYS_STAT_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_SYS_TYPES_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_UNISTD_H 35 | 36 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 37 | */ 38 | #undef LT_OBJDIR 39 | 40 | /* Name of package */ 41 | #undef PACKAGE 42 | 43 | /* Define to the address where bug reports for this package should be sent. */ 44 | #undef PACKAGE_BUGREPORT 45 | 46 | /* Define to the full name of this package. */ 47 | #undef PACKAGE_NAME 48 | 49 | /* Define to the full name and version of this package. */ 50 | #undef PACKAGE_STRING 51 | 52 | /* Define to the one symbol short name of this package. */ 53 | #undef PACKAGE_TARNAME 54 | 55 | /* Define to the home page for this package. */ 56 | #undef PACKAGE_URL 57 | 58 | /* Define to the version of this package. */ 59 | #undef PACKAGE_VERSION 60 | 61 | /* Define to necessary symbol if this constant uses a non-standard name on 62 | your system. */ 63 | #undef PTHREAD_CREATE_JOINABLE 64 | 65 | /* Define to 1 if you have the ANSI C header files. */ 66 | #undef STDC_HEADERS 67 | 68 | /* Version number of package */ 69 | #undef VERSION 70 | -------------------------------------------------------------------------------- /gtest-1.6.0/build/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /gtest-1.6.0/codegear/gtest.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {c1d923e0-6cba-4332-9b6f-3420acbf5091} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Default.Personality 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /gtest-1.6.0/codegear/gtest_all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // C++Builder's IDE cannot build a static library from files with hyphens 35 | // in their name. See http://qc.codegear.com/wc/qcmain.aspx?d=70977 . 36 | // This file serves as a workaround. 37 | 38 | #include "src/gtest-all.cc" 39 | -------------------------------------------------------------------------------- /gtest-1.6.0/codegear/gtest_link.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Links gtest.lib and gtest_main.lib into the current project in C++Builder. 35 | // This means that these libraries can't be renamed, but it's the only way to 36 | // ensure that Debug versus Release test builds are linked against the 37 | // appropriate Debug or Release build of the libraries. 38 | 39 | #pragma link "gtest.lib" 40 | #pragma link "gtest_main.lib" 41 | -------------------------------------------------------------------------------- /gtest-1.6.0/configure.ac: -------------------------------------------------------------------------------- 1 | m4_include(m4/acx_pthread.m4) 2 | 3 | # At this point, the Xcode project assumes the version string will be three 4 | # integers separated by periods and surrounded by square brackets (e.g. 5 | # "[1.0.1]"). It also asumes that there won't be any closing parenthesis 6 | # between "AC_INIT(" and the closing ")" including comments and strings. 7 | AC_INIT([Google C++ Testing Framework], 8 | [1.6.0], 9 | [googletestframework@googlegroups.com], 10 | [gtest]) 11 | 12 | # Provide various options to initialize the Autoconf and configure processes. 13 | AC_PREREQ([2.59]) 14 | AC_CONFIG_SRCDIR([./COPYING]) 15 | AC_CONFIG_MACRO_DIR([m4]) 16 | AC_CONFIG_AUX_DIR([build-aux]) 17 | AC_CONFIG_HEADERS([build-aux/config.h]) 18 | AC_CONFIG_FILES([Makefile]) 19 | AC_CONFIG_FILES([scripts/gtest-config], [chmod +x scripts/gtest-config]) 20 | 21 | # Initialize Automake with various options. We require at least v1.9, prevent 22 | # pedantic complaints about package files, and enable various distribution 23 | # targets. 24 | AM_INIT_AUTOMAKE([1.9 dist-bzip2 dist-zip foreign subdir-objects]) 25 | 26 | # Check for programs used in building Google Test. 27 | AC_PROG_CC 28 | AC_PROG_CXX 29 | AC_LANG([C++]) 30 | AC_PROG_LIBTOOL 31 | 32 | # TODO(chandlerc@google.com): Currently we aren't running the Python tests 33 | # against the interpreter detected by AM_PATH_PYTHON, and so we condition 34 | # HAVE_PYTHON by requiring "python" to be in the PATH, and that interpreter's 35 | # version to be >= 2.3. This will allow the scripts to use a "/usr/bin/env" 36 | # hashbang. 37 | PYTHON= # We *do not* allow the user to specify a python interpreter 38 | AC_PATH_PROG([PYTHON],[python],[:]) 39 | AS_IF([test "$PYTHON" != ":"], 40 | [AM_PYTHON_CHECK_VERSION([$PYTHON],[2.3],[:],[PYTHON=":"])]) 41 | AM_CONDITIONAL([HAVE_PYTHON],[test "$PYTHON" != ":"]) 42 | 43 | # Configure pthreads. 44 | AC_ARG_WITH([pthreads], 45 | [AS_HELP_STRING([--with-pthreads], 46 | [use pthreads (default is yes)])], 47 | [with_pthreads=$withval], 48 | [with_pthreads=check]) 49 | 50 | have_pthreads=no 51 | AS_IF([test "x$with_pthreads" != "xno"], 52 | [ACX_PTHREAD( 53 | [], 54 | [AS_IF([test "x$with_pthreads" != "xcheck"], 55 | [AC_MSG_FAILURE( 56 | [--with-pthreads was specified, but unable to be used])])]) 57 | have_pthreads="$acx_pthread_ok"]) 58 | AM_CONDITIONAL([HAVE_PTHREADS],[test "x$have_pthreads" == "xyes"]) 59 | AC_SUBST(PTHREAD_CFLAGS) 60 | AC_SUBST(PTHREAD_LIBS) 61 | 62 | # TODO(chandlerc@google.com) Check for the necessary system headers. 63 | 64 | # TODO(chandlerc@google.com) Check the types, structures, and other compiler 65 | # and architecture characteristics. 66 | 67 | # Output the generated files. No further autoconf macros may be used. 68 | AC_OUTPUT 69 | -------------------------------------------------------------------------------- /gtest-1.6.0/fused-src/gtest/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | std::cout << "Running main() from gtest_main.cc\n"; 36 | 37 | testing::InitGoogleTest(&argc, argv); 38 | return RUN_ALL_TESTS(); 39 | } 40 | -------------------------------------------------------------------------------- /gtest-1.6.0/include/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Google C++ Testing Framework definitions useful in production code. 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 36 | 37 | // When you need to test the private or protected members of a class, 38 | // use the FRIEND_TEST macro to declare your tests as friends of the 39 | // class. For example: 40 | // 41 | // class MyClass { 42 | // private: 43 | // void MyMethod(); 44 | // FRIEND_TEST(MyClassTest, MyMethod); 45 | // }; 46 | // 47 | // class MyClassTest : public testing::Test { 48 | // // ... 49 | // }; 50 | // 51 | // TEST_F(MyClassTest, MyMethod) { 52 | // // Can call MyClass::MyMethod() here. 53 | // } 54 | 55 | #define FRIEND_TEST(test_case_name, test_name)\ 56 | friend class test_case_name##_##test_name##_Test 57 | 58 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 59 | -------------------------------------------------------------------------------- /gtest-1.6.0/m4/gtest.m4: -------------------------------------------------------------------------------- 1 | dnl GTEST_LIB_CHECK([minimum version [, 2 | dnl action if found [,action if not found]]]) 3 | dnl 4 | dnl Check for the presence of the Google Test library, optionally at a minimum 5 | dnl version, and indicate a viable version with the HAVE_GTEST flag. It defines 6 | dnl standard variables for substitution including GTEST_CPPFLAGS, 7 | dnl GTEST_CXXFLAGS, GTEST_LDFLAGS, and GTEST_LIBS. It also defines 8 | dnl GTEST_VERSION as the version of Google Test found. Finally, it provides 9 | dnl optional custom action slots in the event GTEST is found or not. 10 | AC_DEFUN([GTEST_LIB_CHECK], 11 | [ 12 | dnl Provide a flag to enable or disable Google Test usage. 13 | AC_ARG_ENABLE([gtest], 14 | [AS_HELP_STRING([--enable-gtest], 15 | [Enable tests using the Google C++ Testing Framework. 16 | (Default is enabled.)])], 17 | [], 18 | [enable_gtest=]) 19 | AC_ARG_VAR([GTEST_CONFIG], 20 | [The exact path of Google Test's 'gtest-config' script.]) 21 | AC_ARG_VAR([GTEST_CPPFLAGS], 22 | [C-like preprocessor flags for Google Test.]) 23 | AC_ARG_VAR([GTEST_CXXFLAGS], 24 | [C++ compile flags for Google Test.]) 25 | AC_ARG_VAR([GTEST_LDFLAGS], 26 | [Linker path and option flags for Google Test.]) 27 | AC_ARG_VAR([GTEST_LIBS], 28 | [Library linking flags for Google Test.]) 29 | AC_ARG_VAR([GTEST_VERSION], 30 | [The version of Google Test available.]) 31 | HAVE_GTEST="no" 32 | AS_IF([test "x${enable_gtest}" != "xno"], 33 | [AC_MSG_CHECKING([for 'gtest-config']) 34 | AS_IF([test "x${enable_gtest}" != "xyes"], 35 | [AS_IF([test -x "${enable_gtest}/scripts/gtest-config"], 36 | [GTEST_CONFIG="${enable_gtest}/scripts/gtest-config"], 37 | [GTEST_CONFIG="${enable_gtest}/bin/gtest-config"]) 38 | AS_IF([test -x "${GTEST_CONFIG}"], [], 39 | [AC_MSG_RESULT([no]) 40 | AC_MSG_ERROR([dnl 41 | Unable to locate either a built or installed Google Test. 42 | The specific location '${enable_gtest}' was provided for a built or installed 43 | Google Test, but no 'gtest-config' script could be found at this location.]) 44 | ])], 45 | [AC_PATH_PROG([GTEST_CONFIG], [gtest-config])]) 46 | AS_IF([test -x "${GTEST_CONFIG}"], 47 | [AC_MSG_RESULT([${GTEST_CONFIG}]) 48 | m4_ifval([$1], 49 | [_gtest_min_version="--min-version=$1" 50 | AC_MSG_CHECKING([for Google Test at least version >= $1])], 51 | [_gtest_min_version="--min-version=0" 52 | AC_MSG_CHECKING([for Google Test])]) 53 | AS_IF([${GTEST_CONFIG} ${_gtest_min_version}], 54 | [AC_MSG_RESULT([yes]) 55 | HAVE_GTEST='yes'], 56 | [AC_MSG_RESULT([no])])], 57 | [AC_MSG_RESULT([no])]) 58 | AS_IF([test "x${HAVE_GTEST}" = "xyes"], 59 | [GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags` 60 | GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags` 61 | GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags` 62 | GTEST_LIBS=`${GTEST_CONFIG} --libs` 63 | GTEST_VERSION=`${GTEST_CONFIG} --version` 64 | AC_DEFINE([HAVE_GTEST],[1],[Defined when Google Test is available.])], 65 | [AS_IF([test "x${enable_gtest}" = "xyes"], 66 | [AC_MSG_ERROR([dnl 67 | Google Test was enabled, but no viable version could be found.]) 68 | ])])]) 69 | AC_SUBST([HAVE_GTEST]) 70 | AM_CONDITIONAL([HAVE_GTEST],[test "x$HAVE_GTEST" = "xyes"]) 71 | AS_IF([test "x$HAVE_GTEST" = "xyes"], 72 | [m4_ifval([$2], [$2])], 73 | [m4_ifval([$3], [$3])]) 74 | ]) 75 | -------------------------------------------------------------------------------- /gtest-1.6.0/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # Generated from ltversion.in. 11 | 12 | # serial 3017 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.2.6b]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3017]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.2.6b' 20 | macro_revision='1.3017' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /gtest-1.6.0/make/Makefile: -------------------------------------------------------------------------------- 1 | # A sample Makefile for building Google Test and using it in user 2 | # tests. Please tweak it to suit your environment and project. You 3 | # may want to move it to your project's root directory. 4 | # 5 | # SYNOPSIS: 6 | # 7 | # make [all] - makes everything. 8 | # make TARGET - makes the given target. 9 | # make clean - removes all files generated by make. 10 | 11 | # Please tweak the following variable definitions as needed by your 12 | # project, except GTEST_HEADERS, which you can use in your own targets 13 | # but shouldn't modify. 14 | 15 | # Points to the root of Google Test, relative to where this file is. 16 | # Remember to tweak this if you move this file. 17 | GTEST_DIR = .. 18 | 19 | # Where to find user code. 20 | USER_DIR = ../samples 21 | 22 | # Flags passed to the preprocessor. 23 | CPPFLAGS += -I$(GTEST_DIR)/include 24 | 25 | # Flags passed to the C++ compiler. 26 | CXXFLAGS += -g -Wall -Wextra 27 | 28 | # All tests produced by this Makefile. Remember to add new tests you 29 | # created to the list. 30 | TESTS = sample1_unittest 31 | 32 | # All Google Test headers. Usually you shouldn't change this 33 | # definition. 34 | GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \ 35 | $(GTEST_DIR)/include/gtest/internal/*.h 36 | 37 | # House-keeping build targets. 38 | 39 | all : $(TESTS) 40 | 41 | clean : 42 | rm -f $(TESTS) gtest.a gtest_main.a *.o 43 | 44 | # Builds gtest.a and gtest_main.a. 45 | 46 | # Usually you shouldn't tweak such internal variables, indicated by a 47 | # trailing _. 48 | GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS) 49 | 50 | # For simplicity and to avoid depending on Google Test's 51 | # implementation details, the dependencies specified below are 52 | # conservative and not optimized. This is fine as Google Test 53 | # compiles fast and for ordinary users its source rarely changes. 54 | gtest-all.o : $(GTEST_SRCS_) 55 | $(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \ 56 | $(GTEST_DIR)/src/gtest-all.cc 57 | 58 | gtest_main.o : $(GTEST_SRCS_) 59 | $(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \ 60 | $(GTEST_DIR)/src/gtest_main.cc 61 | 62 | gtest.a : gtest-all.o 63 | $(AR) $(ARFLAGS) $@ $^ 64 | 65 | gtest_main.a : gtest-all.o gtest_main.o 66 | $(AR) $(ARFLAGS) $@ $^ 67 | 68 | # Builds a sample test. A test should link with either gtest.a or 69 | # gtest_main.a, depending on whether it defines its own main() 70 | # function. 71 | 72 | sample1.o : $(USER_DIR)/sample1.cc $(USER_DIR)/sample1.h $(GTEST_HEADERS) 73 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/sample1.cc 74 | 75 | sample1_unittest.o : $(USER_DIR)/sample1_unittest.cc \ 76 | $(USER_DIR)/sample1.h $(GTEST_HEADERS) 77 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/sample1_unittest.cc 78 | 79 | sample1_unittest : sample1.o sample1_unittest.o gtest_main.a 80 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ 81 | -------------------------------------------------------------------------------- /gtest-1.6.0/msvc/gtest-md.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest-md", "gtest-md.vcproj", "{C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_main-md", "gtest_main-md.vcproj", "{3AF54C8A-10BF-4332-9147-F68ED9862033}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | EndProjectSection 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_prod_test-md", "gtest_prod_test-md.vcproj", "{24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}" 11 | ProjectSection(ProjectDependencies) = postProject 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_unittest-md", "gtest_unittest-md.vcproj", "{4D9FDFB5-986A-4139-823C-F4EE0ED481A2}" 15 | ProjectSection(ProjectDependencies) = postProject 16 | EndProjectSection 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfiguration) = preSolution 20 | Debug = Debug 21 | Release = Release 22 | EndGlobalSection 23 | GlobalSection(ProjectConfiguration) = postSolution 24 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug.ActiveCfg = Debug|Win32 25 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug.Build.0 = Debug|Win32 26 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release.ActiveCfg = Release|Win32 27 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release.Build.0 = Release|Win32 28 | {3AF54C8A-10BF-4332-9147-F68ED9862033}.Debug.ActiveCfg = Debug|Win32 29 | {3AF54C8A-10BF-4332-9147-F68ED9862033}.Debug.Build.0 = Debug|Win32 30 | {3AF54C8A-10BF-4332-9147-F68ED9862033}.Release.ActiveCfg = Release|Win32 31 | {3AF54C8A-10BF-4332-9147-F68ED9862033}.Release.Build.0 = Release|Win32 32 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Debug.ActiveCfg = Debug|Win32 33 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Debug.Build.0 = Debug|Win32 34 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Release.ActiveCfg = Release|Win32 35 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Release.Build.0 = Release|Win32 36 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Debug.ActiveCfg = Debug|Win32 37 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Debug.Build.0 = Debug|Win32 38 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Release.ActiveCfg = Release|Win32 39 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Release.Build.0 = Release|Win32 40 | EndGlobalSection 41 | GlobalSection(ExtensibilityGlobals) = postSolution 42 | EndGlobalSection 43 | GlobalSection(ExtensibilityAddIns) = postSolution 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /gtest-1.6.0/msvc/gtest.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest", "gtest.vcproj", "{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_main", "gtest_main.vcproj", "{3AF54C8A-10BF-4332-9147-F68ED9862032}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | EndProjectSection 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_unittest", "gtest_unittest.vcproj", "{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}" 11 | ProjectSection(ProjectDependencies) = postProject 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_prod_test", "gtest_prod_test.vcproj", "{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}" 15 | ProjectSection(ProjectDependencies) = postProject 16 | EndProjectSection 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfiguration) = preSolution 20 | Debug = Debug 21 | Release = Release 22 | EndGlobalSection 23 | GlobalSection(ProjectConfiguration) = postSolution 24 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Debug.ActiveCfg = Debug|Win32 25 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Debug.Build.0 = Debug|Win32 26 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Release.ActiveCfg = Release|Win32 27 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Release.Build.0 = Release|Win32 28 | {3AF54C8A-10BF-4332-9147-F68ED9862032}.Debug.ActiveCfg = Debug|Win32 29 | {3AF54C8A-10BF-4332-9147-F68ED9862032}.Debug.Build.0 = Debug|Win32 30 | {3AF54C8A-10BF-4332-9147-F68ED9862032}.Release.ActiveCfg = Release|Win32 31 | {3AF54C8A-10BF-4332-9147-F68ED9862032}.Release.Build.0 = Release|Win32 32 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Debug.ActiveCfg = Debug|Win32 33 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Debug.Build.0 = Debug|Win32 34 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Release.ActiveCfg = Release|Win32 35 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Release.Build.0 = Release|Win32 36 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Debug.ActiveCfg = Debug|Win32 37 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Debug.Build.0 = Debug|Win32 38 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Release.ActiveCfg = Release|Win32 39 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Release.Build.0 = Release|Win32 40 | EndGlobalSection 41 | GlobalSection(ExtensibilityGlobals) = postSolution 42 | EndGlobalSection 43 | GlobalSection(ExtensibilityAddIns) = postSolution 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /gtest-1.6.0/samples/sample1.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include "sample1.h" 35 | 36 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 37 | int Factorial(int n) { 38 | int result = 1; 39 | for (int i = 1; i <= n; i++) { 40 | result *= i; 41 | } 42 | 43 | return result; 44 | } 45 | 46 | // Returns true iff n is a prime number. 47 | bool IsPrime(int n) { 48 | // Trivial case 1: small numbers 49 | if (n <= 1) return false; 50 | 51 | // Trivial case 2: even numbers 52 | if (n % 2 == 0) return n == 2; 53 | 54 | // Now, we have that n is odd and n >= 3. 55 | 56 | // Try to divide n by every odd number i, starting from 3 57 | for (int i = 3; ; i += 2) { 58 | // We only have to try i up to the squre root of n 59 | if (i > n/i) break; 60 | 61 | // Now, we have i <= n/i < n. 62 | // If n is divisible by i, n is not prime. 63 | if (n % i == 0) return false; 64 | } 65 | 66 | // n has no integer factor in the range (1, n), and thus is prime. 67 | return true; 68 | } 69 | -------------------------------------------------------------------------------- /gtest-1.6.0/samples/sample1.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #ifndef GTEST_SAMPLES_SAMPLE1_H_ 35 | #define GTEST_SAMPLES_SAMPLE1_H_ 36 | 37 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 38 | int Factorial(int n); 39 | 40 | // Returns true iff n is a prime number. 41 | bool IsPrime(int n); 42 | 43 | #endif // GTEST_SAMPLES_SAMPLE1_H_ 44 | -------------------------------------------------------------------------------- /gtest-1.6.0/samples/sample2.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include "sample2.h" 35 | 36 | #include 37 | 38 | // Clones a 0-terminated C string, allocating memory using new. 39 | const char* MyString::CloneCString(const char* a_c_string) { 40 | if (a_c_string == NULL) return NULL; 41 | 42 | const size_t len = strlen(a_c_string); 43 | char* const clone = new char[ len + 1 ]; 44 | memcpy(clone, a_c_string, len + 1); 45 | 46 | return clone; 47 | } 48 | 49 | // Sets the 0-terminated C string this MyString object 50 | // represents. 51 | void MyString::Set(const char* a_c_string) { 52 | // Makes sure this works when c_string == c_string_ 53 | const char* const temp = MyString::CloneCString(a_c_string); 54 | delete[] c_string_; 55 | c_string_ = temp; 56 | } 57 | -------------------------------------------------------------------------------- /gtest-1.6.0/samples/sample2.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #ifndef GTEST_SAMPLES_SAMPLE2_H_ 35 | #define GTEST_SAMPLES_SAMPLE2_H_ 36 | 37 | #include 38 | 39 | 40 | // A simple string class. 41 | class MyString { 42 | private: 43 | const char* c_string_; 44 | const MyString& operator=(const MyString& rhs); 45 | 46 | public: 47 | 48 | // Clones a 0-terminated C string, allocating memory using new. 49 | static const char* CloneCString(const char* a_c_string); 50 | 51 | //////////////////////////////////////////////////////////// 52 | // 53 | // C'tors 54 | 55 | // The default c'tor constructs a NULL string. 56 | MyString() : c_string_(NULL) {} 57 | 58 | // Constructs a MyString by cloning a 0-terminated C string. 59 | explicit MyString(const char* a_c_string) : c_string_(NULL) { 60 | Set(a_c_string); 61 | } 62 | 63 | // Copy c'tor 64 | MyString(const MyString& string) : c_string_(NULL) { 65 | Set(string.c_string_); 66 | } 67 | 68 | //////////////////////////////////////////////////////////// 69 | // 70 | // D'tor. MyString is intended to be a final class, so the d'tor 71 | // doesn't need to be virtual. 72 | ~MyString() { delete[] c_string_; } 73 | 74 | // Gets the 0-terminated C string this MyString object represents. 75 | const char* c_string() const { return c_string_; } 76 | 77 | size_t Length() const { 78 | return c_string_ == NULL ? 0 : strlen(c_string_); 79 | } 80 | 81 | // Sets the 0-terminated C string this MyString object represents. 82 | void Set(const char* c_string); 83 | }; 84 | 85 | 86 | #endif // GTEST_SAMPLES_SAMPLE2_H_ 87 | -------------------------------------------------------------------------------- /gtest-1.6.0/samples/sample4.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include 35 | 36 | #include "sample4.h" 37 | 38 | // Returns the current counter value, and increments it. 39 | int Counter::Increment() { 40 | return counter_++; 41 | } 42 | 43 | // Prints the current counter value to STDOUT. 44 | void Counter::Print() const { 45 | printf("%d", counter_); 46 | } 47 | -------------------------------------------------------------------------------- /gtest-1.6.0/samples/sample4.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #ifndef GTEST_SAMPLES_SAMPLE4_H_ 35 | #define GTEST_SAMPLES_SAMPLE4_H_ 36 | 37 | // A simple monotonic counter. 38 | class Counter { 39 | private: 40 | int counter_; 41 | 42 | public: 43 | // Creates a counter that starts at 0. 44 | Counter() : counter_(0) {} 45 | 46 | // Returns the current counter value, and increments it. 47 | int Increment(); 48 | 49 | // Prints the current counter value to STDOUT. 50 | void Print() const; 51 | }; 52 | 53 | #endif // GTEST_SAMPLES_SAMPLE4_H_ 54 | -------------------------------------------------------------------------------- /gtest-1.6.0/samples/sample4_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | #include "sample4.h" 34 | 35 | // Tests the Increment() method. 36 | TEST(Counter, Increment) { 37 | Counter c; 38 | 39 | // EXPECT_EQ() evaluates its arguments exactly once, so they 40 | // can have side effects. 41 | 42 | EXPECT_EQ(0, c.Increment()); 43 | EXPECT_EQ(1, c.Increment()); 44 | EXPECT_EQ(2, c.Increment()); 45 | } 46 | -------------------------------------------------------------------------------- /gtest-1.6.0/scripts/test/Makefile: -------------------------------------------------------------------------------- 1 | # A Makefile for fusing Google Test and building a sample test against it. 2 | # 3 | # SYNOPSIS: 4 | # 5 | # make [all] - makes everything. 6 | # make TARGET - makes the given target. 7 | # make check - makes everything and runs the built sample test. 8 | # make clean - removes all files generated by make. 9 | 10 | # Points to the root of fused Google Test, relative to where this file is. 11 | FUSED_GTEST_DIR = output 12 | 13 | # Paths to the fused gtest files. 14 | FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h 15 | FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 16 | 17 | # Where to find the sample test. 18 | SAMPLE_DIR = ../../samples 19 | 20 | # Where to find gtest_main.cc. 21 | GTEST_MAIN_CC = ../../src/gtest_main.cc 22 | 23 | # Flags passed to the preprocessor. 24 | # We have no idea here whether pthreads is available in the system, so 25 | # disable its use. 26 | CPPFLAGS += -I$(FUSED_GTEST_DIR) -DGTEST_HAS_PTHREAD=0 27 | 28 | # Flags passed to the C++ compiler. 29 | CXXFLAGS += -g 30 | 31 | all : sample1_unittest 32 | 33 | check : all 34 | ./sample1_unittest 35 | 36 | clean : 37 | rm -rf $(FUSED_GTEST_DIR) sample1_unittest *.o 38 | 39 | $(FUSED_GTEST_H) : 40 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 41 | 42 | $(FUSED_GTEST_ALL_CC) : 43 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 44 | 45 | gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC) 46 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 47 | 48 | gtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC) 49 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC) 50 | 51 | sample1.o : $(SAMPLE_DIR)/sample1.cc $(SAMPLE_DIR)/sample1.h 52 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1.cc 53 | 54 | sample1_unittest.o : $(SAMPLE_DIR)/sample1_unittest.cc \ 55 | $(SAMPLE_DIR)/sample1.h $(FUSED_GTEST_H) 56 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1_unittest.cc 57 | 58 | sample1_unittest : sample1.o sample1_unittest.o gtest-all.o gtest_main.o 59 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ 60 | -------------------------------------------------------------------------------- /gtest-1.6.0/src/gtest-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Sometimes it's desirable to build Google Test by compiling a single file. 35 | // This file serves this purpose. 36 | 37 | // This line ensures that gtest.h can be compiled on its own, even 38 | // when it's fused. 39 | #include "gtest/gtest.h" 40 | 41 | // The following lines pull in the real gtest *.cc files. 42 | #include "src/gtest.cc" 43 | #include "src/gtest-death-test.cc" 44 | #include "src/gtest-filepath.cc" 45 | #include "src/gtest-port.cc" 46 | #include "src/gtest-printers.cc" 47 | #include "src/gtest-test-part.cc" 48 | #include "src/gtest-typed-test.cc" 49 | -------------------------------------------------------------------------------- /gtest-1.6.0/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | std::cout << "Running main() from gtest_main.cc\n"; 36 | 37 | testing::InitGoogleTest(&argc, argv); 38 | return RUN_ALL_TESTS(); 39 | } 40 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest-param-test2_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: vladl@google.com (Vlad Losev) 31 | // 32 | // Tests for Google Test itself. This verifies that the basic constructs of 33 | // Google Test work. 34 | 35 | #include "gtest/gtest.h" 36 | 37 | #include "test/gtest-param-test_test.h" 38 | 39 | #if GTEST_HAS_PARAM_TEST 40 | 41 | using ::testing::Values; 42 | using ::testing::internal::ParamGenerator; 43 | 44 | // Tests that generators defined in a different translation unit 45 | // are functional. The test using extern_gen is defined 46 | // in gtest-param-test_test.cc. 47 | ParamGenerator extern_gen = Values(33); 48 | 49 | // Tests that a parameterized test case can be defined in one translation unit 50 | // and instantiated in another. The test is defined in gtest-param-test_test.cc 51 | // and ExternalInstantiationTest fixture class is defined in 52 | // gtest-param-test_test.h. 53 | INSTANTIATE_TEST_CASE_P(MultiplesOf33, 54 | ExternalInstantiationTest, 55 | Values(33, 66)); 56 | 57 | // Tests that a parameterized test case can be instantiated 58 | // in multiple translation units. Another instantiation is defined 59 | // in gtest-param-test_test.cc and InstantiationInMultipleTranslaionUnitsTest 60 | // fixture is defined in gtest-param-test_test.h 61 | INSTANTIATE_TEST_CASE_P(Sequence2, 62 | InstantiationInMultipleTranslaionUnitsTest, 63 | Values(42*3, 42*4, 42*5)); 64 | 65 | #endif // GTEST_HAS_PARAM_TEST 66 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest-param-test_test.h: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Authors: vladl@google.com (Vlad Losev) 31 | // 32 | // The Google C++ Testing Framework (Google Test) 33 | // 34 | // This header file provides classes and functions used internally 35 | // for testing Google Test itself. 36 | 37 | #ifndef GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ 38 | #define GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ 39 | 40 | #include "gtest/gtest.h" 41 | 42 | #if GTEST_HAS_PARAM_TEST 43 | 44 | // Test fixture for testing definition and instantiation of a test 45 | // in separate translation units. 46 | class ExternalInstantiationTest : public ::testing::TestWithParam {}; 47 | 48 | // Test fixture for testing instantiation of a test in multiple 49 | // translation units. 50 | class InstantiationInMultipleTranslaionUnitsTest 51 | : public ::testing::TestWithParam {}; 52 | 53 | #endif // GTEST_HAS_PARAM_TEST 54 | 55 | #endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ 56 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest-typed-test2_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include 33 | 34 | #include "test/gtest-typed-test_test.h" 35 | #include "gtest/gtest.h" 36 | 37 | #if GTEST_HAS_TYPED_TEST_P 38 | 39 | // Tests that the same type-parameterized test case can be 40 | // instantiated in different translation units linked together. 41 | // (ContainerTest is also instantiated in gtest-typed-test_test.cc.) 42 | INSTANTIATE_TYPED_TEST_CASE_P(Vector, ContainerTest, 43 | testing::Types >); 44 | 45 | #endif // GTEST_HAS_TYPED_TEST_P 46 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest-typed-test_test.h: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #ifndef GTEST_TEST_GTEST_TYPED_TEST_TEST_H_ 33 | #define GTEST_TEST_GTEST_TYPED_TEST_TEST_H_ 34 | 35 | #include "gtest/gtest.h" 36 | 37 | #if GTEST_HAS_TYPED_TEST_P 38 | 39 | using testing::Test; 40 | 41 | // For testing that the same type-parameterized test case can be 42 | // instantiated in different translation units linked together. 43 | // ContainerTest will be instantiated in both gtest-typed-test_test.cc 44 | // and gtest-typed-test2_test.cc. 45 | 46 | template 47 | class ContainerTest : public Test { 48 | }; 49 | 50 | TYPED_TEST_CASE_P(ContainerTest); 51 | 52 | TYPED_TEST_P(ContainerTest, CanBeDefaultConstructed) { 53 | TypeParam container; 54 | } 55 | 56 | TYPED_TEST_P(ContainerTest, InitialSizeIsZero) { 57 | TypeParam container; 58 | EXPECT_EQ(0U, container.size()); 59 | } 60 | 61 | REGISTER_TYPED_TEST_CASE_P(ContainerTest, 62 | CanBeDefaultConstructed, InitialSizeIsZero); 63 | 64 | #endif // GTEST_HAS_TYPED_TEST_P 65 | 66 | #endif // GTEST_TEST_GTEST_TYPED_TEST_TEST_H_ 67 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_all_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Tests for Google C++ Testing Framework (Google Test) 33 | // 34 | // Sometimes it's desirable to build most of Google Test's own tests 35 | // by compiling a single file. This file serves this purpose. 36 | #include "test/gtest-filepath_test.cc" 37 | #include "test/gtest-linked_ptr_test.cc" 38 | #include "test/gtest-message_test.cc" 39 | #include "test/gtest-options_test.cc" 40 | #include "test/gtest-port_test.cc" 41 | #include "test/gtest_pred_impl_unittest.cc" 42 | #include "test/gtest_prod_test.cc" 43 | #include "test/gtest-test-part_test.cc" 44 | #include "test/gtest-typed-test_test.cc" 45 | #include "test/gtest-typed-test2_test.cc" 46 | #include "test/gtest_unittest.cc" 47 | #include "test/production.cc" 48 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_color_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | // A helper program for testing how Google Test determines whether to use 33 | // colors in the output. It prints "YES" and returns 1 if Google Test 34 | // decides to use colors, and prints "NO" and returns 0 otherwise. 35 | 36 | #include 37 | 38 | #include "gtest/gtest.h" 39 | 40 | // Indicates that this translation unit is part of Google Test's 41 | // implementation. It must come before gtest-internal-inl.h is 42 | // included, or there will be a compiler error. This trick is to 43 | // prevent a user from accidentally including gtest-internal-inl.h in 44 | // his code. 45 | #define GTEST_IMPLEMENTATION_ 1 46 | #include "src/gtest-internal-inl.h" 47 | #undef GTEST_IMPLEMENTATION_ 48 | 49 | using testing::internal::ShouldUseColor; 50 | 51 | // The purpose of this is to ensure that the UnitTest singleton is 52 | // created before main() is entered, and thus that ShouldUseColor() 53 | // works the same way as in a real Google-Test-based test. We don't actual 54 | // run the TEST itself. 55 | TEST(GTestColorTest, Dummy) { 56 | } 57 | 58 | int main(int argc, char** argv) { 59 | testing::InitGoogleTest(&argc, argv); 60 | 61 | if (ShouldUseColor(true)) { 62 | // Google Test decides to use colors in the output (assuming it 63 | // goes to a TTY). 64 | printf("YES\n"); 65 | return 1; 66 | } else { 67 | // Google Test decides not to use colors in the output. 68 | printf("NO\n"); 69 | return 0; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_help_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | // This program is meant to be run by gtest_help_test.py. Do not run 33 | // it directly. 34 | 35 | #include "gtest/gtest.h" 36 | 37 | // When a help flag is specified, this program should skip the tests 38 | // and exit with 0; otherwise the following test will be executed, 39 | // causing this program to exit with a non-zero code. 40 | TEST(HelpFlagTest, ShouldNotBeRun) { 41 | ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified."; 42 | } 43 | 44 | #if GTEST_HAS_DEATH_TEST 45 | TEST(DeathTest, UsedByPythonScriptToDetectSupportForDeathTestsInThisBinary) {} 46 | #endif 47 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_list_tests_unittest_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: phanna@google.com (Patrick Hanna) 31 | 32 | // Unit test for Google Test's --gtest_list_tests flag. 33 | // 34 | // A user can ask Google Test to list all tests that will run 35 | // so that when using a filter, a user will know what 36 | // tests to look for. The tests will not be run after listing. 37 | // 38 | // This program will be invoked from a Python unit test. 39 | // Don't run it directly. 40 | 41 | #include "gtest/gtest.h" 42 | 43 | namespace { 44 | 45 | // Several different test cases and tests that will be listed. 46 | TEST(Foo, Bar1) { 47 | } 48 | 49 | TEST(Foo, Bar2) { 50 | } 51 | 52 | TEST(Foo, DISABLED_Bar3) { 53 | } 54 | 55 | TEST(Abc, Xyz) { 56 | } 57 | 58 | TEST(Abc, Def) { 59 | } 60 | 61 | TEST(FooBar, Baz) { 62 | } 63 | 64 | class FooTest : public testing::Test { 65 | }; 66 | 67 | TEST_F(FooTest, Test1) { 68 | } 69 | 70 | TEST_F(FooTest, DISABLED_Test2) { 71 | } 72 | 73 | TEST_F(FooTest, Test3) { 74 | } 75 | 76 | TEST(FooDeathTest, Test1) { 77 | } 78 | 79 | } // namespace 80 | 81 | int main(int argc, char **argv) { 82 | ::testing::InitGoogleTest(&argc, argv); 83 | 84 | return RUN_ALL_TESTS(); 85 | } 86 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_main_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | 34 | // Tests that we don't have to define main() when we link to 35 | // gtest_main instead of gtest. 36 | 37 | namespace { 38 | 39 | TEST(GTestMainTest, ShouldSucceed) { 40 | } 41 | 42 | } // namespace 43 | 44 | // We are using the main() function defined in src/gtest_main.cc, so 45 | // we don't define it here. 46 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_no_test_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Tests that a Google Test program that has no test defined can run 31 | // successfully. 32 | // 33 | // Author: wan@google.com (Zhanyong Wan) 34 | 35 | #include "gtest/gtest.h" 36 | 37 | 38 | int main(int argc, char **argv) { 39 | testing::InitGoogleTest(&argc, argv); 40 | 41 | // An ad-hoc assertion outside of all tests. 42 | // 43 | // This serves three purposes: 44 | // 45 | // 1. It verifies that an ad-hoc assertion can be executed even if 46 | // no test is defined. 47 | // 2. It verifies that a failed ad-hoc assertion causes the test 48 | // program to fail. 49 | // 3. We had a bug where the XML output won't be generated if an 50 | // assertion is executed before RUN_ALL_TESTS() is called, even 51 | // though --gtest_output=xml is specified. This makes sure the 52 | // bug is fixed and doesn't regress. 53 | EXPECT_EQ(1, 2); 54 | 55 | // The above EXPECT_EQ() should cause RUN_ALL_TESTS() to return non-zero. 56 | return RUN_ALL_TESTS() ? 0 : 1; 57 | } 58 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_prod_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Unit test for include/gtest/gtest_prod.h. 33 | 34 | #include "gtest/gtest.h" 35 | #include "test/production.h" 36 | 37 | // Tests that private members can be accessed from a TEST declared as 38 | // a friend of the class. 39 | TEST(PrivateCodeTest, CanAccessPrivateMembers) { 40 | PrivateCode a; 41 | EXPECT_EQ(0, a.x_); 42 | 43 | a.set_x(1); 44 | EXPECT_EQ(1, a.x_); 45 | } 46 | 47 | typedef testing::Test PrivateCodeFixtureTest; 48 | 49 | // Tests that private members can be accessed from a TEST_F declared 50 | // as a friend of the class. 51 | TEST_F(PrivateCodeFixtureTest, CanAccessPrivateMembers) { 52 | PrivateCode a; 53 | EXPECT_EQ(0, a.x_); 54 | 55 | a.set_x(2); 56 | EXPECT_EQ(2, a.x_); 57 | } 58 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_sole_header_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // This test verifies that it's possible to use Google Test by including 33 | // the gtest.h header file alone. 34 | 35 | #include "gtest/gtest.h" 36 | 37 | namespace { 38 | 39 | void Subroutine() { 40 | EXPECT_EQ(42, 42); 41 | } 42 | 43 | TEST(NoFatalFailureTest, ExpectNoFatalFailure) { 44 | EXPECT_NO_FATAL_FAILURE(;); 45 | EXPECT_NO_FATAL_FAILURE(SUCCEED()); 46 | EXPECT_NO_FATAL_FAILURE(Subroutine()); 47 | EXPECT_NO_FATAL_FAILURE({ SUCCEED(); }); 48 | } 49 | 50 | TEST(NoFatalFailureTest, AssertNoFatalFailure) { 51 | ASSERT_NO_FATAL_FAILURE(;); 52 | ASSERT_NO_FATAL_FAILURE(SUCCEED()); 53 | ASSERT_NO_FATAL_FAILURE(Subroutine()); 54 | ASSERT_NO_FATAL_FAILURE({ SUCCEED(); }); 55 | } 56 | 57 | } // namespace 58 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_throw_on_failure_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | // Tests Google Test's throw-on-failure mode with exceptions disabled. 33 | // 34 | // This program must be compiled with exceptions disabled. It will be 35 | // invoked by gtest_throw_on_failure_test.py, and is expected to exit 36 | // with non-zero in the throw-on-failure mode or 0 otherwise. 37 | 38 | #include "gtest/gtest.h" 39 | 40 | int main(int argc, char** argv) { 41 | testing::InitGoogleTest(&argc, argv); 42 | 43 | // We want to ensure that people can use Google Test assertions in 44 | // other testing frameworks, as long as they initialize Google Test 45 | // properly and set the thrown-on-failure mode. Therefore, we don't 46 | // use Google Test's constructs for defining and running tests 47 | // (e.g. TEST and RUN_ALL_TESTS) here. 48 | 49 | // In the throw-on-failure mode with exceptions disabled, this 50 | // assertion will cause the program to exit with a non-zero code. 51 | EXPECT_EQ(2, 3); 52 | 53 | // When not in the throw-on-failure mode, the control will reach 54 | // here. 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_uninitialized_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2008, Google Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | """Verifies that Google Test warns the user when not initialized properly.""" 33 | 34 | __author__ = 'wan@google.com (Zhanyong Wan)' 35 | 36 | import gtest_test_utils 37 | 38 | 39 | COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_uninitialized_test_') 40 | 41 | 42 | def Assert(condition): 43 | if not condition: 44 | raise AssertionError 45 | 46 | 47 | def AssertEq(expected, actual): 48 | if expected != actual: 49 | print 'Expected: %s' % (expected,) 50 | print ' Actual: %s' % (actual,) 51 | raise AssertionError 52 | 53 | 54 | def TestExitCodeAndOutput(command): 55 | """Runs the given command and verifies its exit code and output.""" 56 | 57 | # Verifies that 'command' exits with code 1. 58 | p = gtest_test_utils.Subprocess(command) 59 | Assert(p.exited) 60 | AssertEq(1, p.exit_code) 61 | Assert('InitGoogleTest' in p.output) 62 | 63 | 64 | class GTestUninitializedTest(gtest_test_utils.TestCase): 65 | def testExitCodeAndOutput(self): 66 | TestExitCodeAndOutput(COMMAND) 67 | 68 | 69 | if __name__ == '__main__': 70 | gtest_test_utils.Main() 71 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_uninitialized_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | 34 | TEST(DummyTest, Dummy) { 35 | // This test doesn't verify anything. We just need it to create a 36 | // realistic stage for testing the behavior of Google Test when 37 | // RUN_ALL_TESTS() is called without testing::InitGoogleTest() being 38 | // called first. 39 | } 40 | 41 | int main() { 42 | return RUN_ALL_TESTS(); 43 | } 44 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_xml_outfile1_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: keith.ray@gmail.com (Keith Ray) 31 | // 32 | // gtest_xml_outfile1_test_ writes some xml via TestProperty used by 33 | // gtest_xml_outfiles_test.py 34 | 35 | #include "gtest/gtest.h" 36 | 37 | class PropertyOne : public testing::Test { 38 | protected: 39 | virtual void SetUp() { 40 | RecordProperty("SetUpProp", 1); 41 | } 42 | virtual void TearDown() { 43 | RecordProperty("TearDownProp", 1); 44 | } 45 | }; 46 | 47 | TEST_F(PropertyOne, TestSomeProperties) { 48 | RecordProperty("TestSomeProperty", 1); 49 | } 50 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/gtest_xml_outfile2_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: keith.ray@gmail.com (Keith Ray) 31 | // 32 | // gtest_xml_outfile2_test_ writes some xml via TestProperty used by 33 | // gtest_xml_outfiles_test.py 34 | 35 | #include "gtest/gtest.h" 36 | 37 | class PropertyTwo : public testing::Test { 38 | protected: 39 | virtual void SetUp() { 40 | RecordProperty("SetUpProp", 2); 41 | } 42 | virtual void TearDown() { 43 | RecordProperty("TearDownProp", 2); 44 | } 45 | }; 46 | 47 | TEST_F(PropertyTwo, TestSomeProperties) { 48 | RecordProperty("TestSomeProperty", 2); 49 | } 50 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #include "production.h" 35 | 36 | PrivateCode::PrivateCode() : x_(0) {} 37 | -------------------------------------------------------------------------------- /gtest-1.6.0/test/production.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #ifndef GTEST_TEST_PRODUCTION_H_ 35 | #define GTEST_TEST_PRODUCTION_H_ 36 | 37 | #include "gtest/gtest_prod.h" 38 | 39 | class PrivateCode { 40 | public: 41 | // Declares a friend test that does not use a fixture. 42 | FRIEND_TEST(PrivateCodeTest, CanAccessPrivateMembers); 43 | 44 | // Declares a friend test that uses a fixture. 45 | FRIEND_TEST(PrivateCodeFixtureTest, CanAccessPrivateMembers); 46 | 47 | PrivateCode(); 48 | 49 | int x() const { return x_; } 50 | private: 51 | void set_x(int an_x) { x_ = an_x; } 52 | int x_; 53 | }; 54 | 55 | #endif // GTEST_TEST_PRODUCTION_H_ 56 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Config/DebugProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugProject.xcconfig 3 | // 4 | // These are Debug Configuration project settings for the gtest framework and 5 | // examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // No optimization 14 | GCC_OPTIMIZATION_LEVEL = 0 15 | 16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 17 | DEPLOYMENT_POSTPROCESSING = NO 18 | 19 | // Dead code stripping off 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | // Debug symbols should be on obviously 23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 24 | 25 | // Define the DEBUG macro in all debug builds 26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 27 | 28 | // These are turned off to avoid STL incompatibilities with client code 29 | // // Turns on special C++ STL checks to "encourage" good STL use 30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 31 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Config/FrameworkTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // FrameworkTarget.xcconfig 3 | // 4 | // These are Framework target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Dynamic libs need to be position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Dynamic libs should not have their external symbols stripped. 14 | STRIP_STYLE = non-global 15 | 16 | // Let the user install by specifying the $DSTROOT with xcodebuild 17 | SKIP_INSTALL = NO 18 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Config/General.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // General.xcconfig 3 | // 4 | // These are General configuration settings for the gtest framework and 5 | // examples. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Build for PPC and Intel, 32- and 64-bit 11 | ARCHS = i386 x86_64 ppc ppc64 12 | 13 | // Zerolink prevents link warnings so turn it off 14 | ZERO_LINK = NO 15 | 16 | // Prebinding considered unhelpful in 10.3 and later 17 | PREBINDING = NO 18 | 19 | // Strictest warning policy 20 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow 21 | 22 | // Work around Xcode bugs by using external strip. See: 23 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html 24 | SEPARATE_STRIP = YES 25 | 26 | // Force C99 dialect 27 | GCC_C_LANGUAGE_STANDARD = c99 28 | 29 | // not sure why apple defaults this on, but it's pretty risky 30 | ALWAYS_SEARCH_USER_PATHS = NO 31 | 32 | // Turn on position dependent code for most cases (overridden where appropriate) 33 | GCC_DYNAMIC_NO_PIC = YES 34 | 35 | // Default SDK and minimum OS version is 10.4 36 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk 37 | MACOSX_DEPLOYMENT_TARGET = 10.4 38 | GCC_VERSION = 4.0 39 | 40 | // VERSIONING BUILD SETTINGS (used in Info.plist) 41 | GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc. 42 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Config/ReleaseProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseProject.xcconfig 3 | // 4 | // These are Release Configuration project settings for the gtest framework 5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // subconfig/Release.xcconfig 14 | 15 | // Optimize for space and size (Apple recommendation) 16 | GCC_OPTIMIZATION_LEVEL = s 17 | 18 | // Deploment postprocessing is what triggers Xcode to strip 19 | DEPLOYMENT_POSTPROCESSING = YES 20 | 21 | // No symbols 22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 23 | 24 | // Dead code strip does not affect ObjC code but can help for C 25 | DEAD_CODE_STRIPPING = YES 26 | 27 | // NDEBUG is used by things like assert.h, so define it for general compat. 28 | // ASSERT going away in release tends to create unused vars. 29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 30 | 31 | // When we strip we want to strip all symbols in release, but save externals. 32 | STRIP_STYLE = all 33 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Config/StaticLibraryTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibraryTarget.xcconfig 3 | // 4 | // These are static library target settings for libgtest.a. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Static libs can be included in bundles so make them position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Static libs should not have their internal globals or external symbols 14 | // stripped. 15 | STRIP_STYLE = debugging 16 | 17 | // Let the user install by specifying the $DSTROOT with xcodebuild 18 | SKIP_INSTALL = NO 19 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Config/TestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../include 9 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.${PRODUCT_NAME} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | GTEST_VERSIONINFO_LONG 21 | CFBundleShortVersionString 22 | GTEST_VERSIONINFO_SHORT 23 | CFBundleGetInfoString 24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT} 25 | NSHumanReadableCopyright 26 | ${GTEST_VERSIONINFO_ABOUT} 27 | CSResourcesFileMapped 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Samples/FrameworkSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.gtest.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Samples/FrameworkSample/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2008, Google Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # Executes the samples and tests for the Google Test Framework. 33 | 34 | # Help the dynamic linker find the path to the libraries. 35 | export DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR 36 | export DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR 37 | 38 | # Create some executables. 39 | test_executables=$@ 40 | 41 | # Now execute each one in turn keeping track of how many succeeded and failed. 42 | succeeded=0 43 | failed=0 44 | failed_list=() 45 | for test in ${test_executables[*]}; do 46 | "$test" 47 | result=$? 48 | if [ $result -eq 0 ]; then 49 | succeeded=$(( $succeeded + 1 )) 50 | else 51 | failed=$(( failed + 1 )) 52 | failed_list="$failed_list $test" 53 | fi 54 | done 55 | 56 | # Report the successes and failures to the console. 57 | echo "Tests complete with $succeeded successes and $failed failures." 58 | if [ $failed -ne 0 ]; then 59 | echo "The following tests failed:" 60 | echo $failed_list 61 | fi 62 | exit $failed 63 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Samples/FrameworkSample/widget.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: preston.a.jackson@gmail.com (Preston Jackson) 31 | // 32 | // Google Test - FrameworkSample 33 | // widget.cc 34 | // 35 | 36 | // Widget is a very simple class used for demonstrating the use of gtest 37 | 38 | #include "widget.h" 39 | 40 | Widget::Widget(int number, const std::string& name) 41 | : number_(number), 42 | name_(name) {} 43 | 44 | Widget::~Widget() {} 45 | 46 | float Widget::GetFloatValue() const { 47 | return number_; 48 | } 49 | 50 | int Widget::GetIntValue() const { 51 | return static_cast(number_); 52 | } 53 | 54 | std::string Widget::GetStringValue() const { 55 | return name_; 56 | } 57 | 58 | void Widget::GetCharPtrValue(char* buffer, size_t max_size) const { 59 | // Copy the char* representation of name_ into buffer, up to max_size. 60 | strncpy(buffer, name_.c_str(), max_size-1); 61 | buffer[max_size-1] = '\0'; 62 | return; 63 | } 64 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Samples/FrameworkSample/widget.h: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: preston.a.jackson@gmail.com (Preston Jackson) 31 | // 32 | // Google Test - FrameworkSample 33 | // widget.h 34 | // 35 | 36 | // Widget is a very simple class used for demonstrating the use of gtest. It 37 | // simply stores two values a string and an integer, which are returned via 38 | // public accessors in multiple forms. 39 | 40 | #import 41 | 42 | class Widget { 43 | public: 44 | Widget(int number, const std::string& name); 45 | ~Widget(); 46 | 47 | // Public accessors to number data 48 | float GetFloatValue() const; 49 | int GetIntValue() const; 50 | 51 | // Public accessors to the string data 52 | std::string GetStringValue() const; 53 | void GetCharPtrValue(char* buffer, size_t max_size) const; 54 | 55 | private: 56 | // Data members 57 | float number_; 58 | std::string name_; 59 | }; 60 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Samples/FrameworkSample/widget_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: preston.a.jackson@gmail.com (Preston Jackson) 31 | // 32 | // Google Test - FrameworkSample 33 | // widget_test.cc 34 | // 35 | 36 | // This is a simple test file for the Widget class in the Widget.framework 37 | 38 | #include 39 | #include "gtest/gtest.h" 40 | 41 | #include 42 | 43 | // This test verifies that the constructor sets the internal state of the 44 | // Widget class correctly. 45 | TEST(WidgetInitializerTest, TestConstructor) { 46 | Widget widget(1.0f, "name"); 47 | EXPECT_FLOAT_EQ(1.0f, widget.GetFloatValue()); 48 | EXPECT_EQ(std::string("name"), widget.GetStringValue()); 49 | } 50 | 51 | // This test verifies the conversion of the float and string values to int and 52 | // char*, respectively. 53 | TEST(WidgetInitializerTest, TestConversion) { 54 | Widget widget(1.0f, "name"); 55 | EXPECT_EQ(1, widget.GetIntValue()); 56 | 57 | size_t max_size = 128; 58 | char buffer[max_size]; 59 | widget.GetCharPtrValue(buffer, max_size); 60 | EXPECT_STREQ("name", buffer); 61 | } 62 | 63 | // Use the Google Test main that is linked into the framework. It does something 64 | // like this: 65 | // int main(int argc, char** argv) { 66 | // testing::InitGoogleTest(&argc, argv); 67 | // return RUN_ALL_TESTS(); 68 | // } 69 | -------------------------------------------------------------------------------- /gtest-1.6.0/xcode/Scripts/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2008, Google Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # Executes the samples and tests for the Google Test Framework. 33 | 34 | # Help the dynamic linker find the path to the libraries. 35 | export DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR 36 | export DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR 37 | 38 | # Create some executables. 39 | test_executables=("$BUILT_PRODUCTS_DIR/gtest_unittest-framework" 40 | "$BUILT_PRODUCTS_DIR/gtest_unittest" 41 | "$BUILT_PRODUCTS_DIR/sample1_unittest-framework" 42 | "$BUILT_PRODUCTS_DIR/sample1_unittest-static") 43 | 44 | # Now execute each one in turn keeping track of how many succeeded and failed. 45 | succeeded=0 46 | failed=0 47 | failed_list=() 48 | for test in ${test_executables[*]}; do 49 | "$test" 50 | result=$? 51 | if [ $result -eq 0 ]; then 52 | succeeded=$(( $succeeded + 1 )) 53 | else 54 | failed=$(( failed + 1 )) 55 | failed_list="$failed_list $test" 56 | fi 57 | done 58 | 59 | # Report the successes and failures to the console. 60 | echo "Tests complete with $succeeded successes and $failed failures." 61 | if [ $failed -ne 0 ]; then 62 | echo "The following tests failed:" 63 | echo $failed_list 64 | fi 65 | exit $failed 66 | -------------------------------------------------------------------------------- /include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(sdsl) 2 | -------------------------------------------------------------------------------- /include/sdsl/.gitignore: -------------------------------------------------------------------------------- 1 | rrr_vector2.hpp 2 | rrr_vector3.hpp 3 | rrr_vector4.hpp 4 | wt_rlg4.hpp 5 | -------------------------------------------------------------------------------- /include/sdsl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(CheckIncludeFile) 2 | include(CheckIncludeFileCXX) 3 | include(CheckTypeSize) 4 | 5 | ## Check for header files ## 6 | check_include_file_CXX(cstdio HAVE_STDIO) 7 | check_include_file(stdint.h HAVE_STDINT_H) 8 | check_include_file(inttypes.h HAVE_INTTYPES_H) 9 | 10 | if( HAVE_STDINT_H ) 11 | set( INTINCFILE "#include " ) 12 | elseif( HAVE_INTTYPES_H ) 13 | set( INTINCFILE "#include " ) 14 | else() 15 | set( INTINCFILE "" ) 16 | endif() 17 | 18 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/uintx_t.hpp.cmake" 19 | "${CMAKE_CURRENT_BINARY_DIR}/uintx_t.hpp" @ONLY) 20 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.hpp.cmake" 21 | "${CMAKE_CURRENT_BINARY_DIR}/config.hpp" @ONLY) 22 | 23 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/uintx_t.hpp" DESTINATION include/sdsl) 24 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config.hpp" DESTINATION include/sdsl) 25 | 26 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/algorithms_for_suffix_array_construction.hpp.cmake" 27 | "${CMAKE_CURRENT_BINARY_DIR}/algorithms_for_suffix_array_construction.hpp") 28 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/algorithms_for_suffix_array_construction.hpp" DESTINATION include/sdsl) 29 | 30 | ## copy hpp files to the binary tree ## 31 | 32 | file(GLOB hppFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") # select all .hpp-files 33 | 34 | foreach(hppFile ${hppFiles}) # copy each file 35 | configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/${hppFile}" "${CMAKE_CURRENT_BINARY_DIR}/${hppFile}" COPYONLY ) 36 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${hppFile}" DESTINATION include/sdsl) 37 | # MESSAGE(${hppFile}) 38 | endforeach(hppFile) 39 | 40 | -------------------------------------------------------------------------------- /include/sdsl/TODO.txt: -------------------------------------------------------------------------------- 1 | wt_rlgX: do a generalize version of the implementations so that 2 | the X is a template parameter of wt_rlg 3 | -------------------------------------------------------------------------------- /include/sdsl/bit_vectors.hpp: -------------------------------------------------------------------------------- 1 | /*! \file bit_vectors.hpp 2 | \brief bit_vectors.hpp contains classes for uncompressed and compressed bit vector representations. 3 | \author Simon Gog 4 | */ 5 | #ifndef INCLUDED_SDSL_BITVECTORS 6 | #define INCLUDED_SDSL_BITVECTORS 7 | 8 | #include "int_vector.hpp" 9 | #include "bit_vector_interleaved.hpp" 10 | #include "rrr_vector.hpp" 11 | #include "sd_vector.hpp" 12 | #include "gap_vector.hpp" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /include/sdsl/bp_support.hpp: -------------------------------------------------------------------------------- 1 | /* sdsl - succinct data structures library 2 | Copyright (C) 2009 Simon Gog 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see http://www.gnu.org/licenses/ . 16 | */ 17 | /*! \file bp_support.hpp 18 | \brief bp_support.hpp contains several classed which support find_open, find_close, enclose and rr-enclose queries. 19 | \author Simon Gog 20 | */ 21 | 22 | #ifndef INCLUDED_SDSL_BP_SUPPORT 23 | #define INCLUDED_SDSL_BP_SUPPORT 24 | 25 | /** \defgroup bps Balanced Parentheses Supports (BPS) 26 | * This group contains data structures which supports a sdsl::bit_vector with the following methods: 27 | * - find_open 28 | * - find_close 29 | * - enclose 30 | * - rank 31 | * - select 32 | * - excess 33 | * - (rr_enclose) 34 | */ 35 | 36 | #include "bp_support_j.hpp" 37 | #include "bp_support_g.hpp" 38 | #include "bp_support_gg.hpp" 39 | #include "bp_support_sada.hpp" 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/sdsl/coder.hpp: -------------------------------------------------------------------------------- 1 | /* sdsl - succinct data structures library 2 | Copyright (C) 2008 Simon Gog 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see http://www.gnu.org/licenses/ . 16 | */ 17 | /*! \file coder.hpp 18 | \brief coder.hpp contains the coder namespace and includes the header files of sdsl::coder::fibonacci, sdsl::coder::elias_delta, sdsl::coder::ternary, and sdsl::coder::run_length 19 | \author Simon Gog 20 | */ 21 | #ifndef SDSL_CODER 22 | #define SDSL_CODER 23 | 24 | #include "int_vector.hpp" 25 | #include "fibonacci_coder.hpp" 26 | #include "elias_delta_coder.hpp" 27 | #include "ternary_coder.hpp" 28 | 29 | namespace sdsl 30 | { 31 | 32 | //! Namespace for the different coder of the sdsl. 33 | namespace coder 34 | { 35 | 36 | template 37 | class run_length 38 | { 39 | public: 40 | typedef uint64_t size_type; 41 | static void encode(uint64_t x, uint64_t*& z, uint8_t offset); 42 | static uint64_t encoding_length(const uint64_t* s, uint8_t s_offset, size_type bit_length); 43 | }; 44 | 45 | template 46 | typename run_length::size_type run_length::encoding_length(const uint64_t* s, uint8_t s_offset, size_type bit_length) 47 | { 48 | assert(s_offset < 64); 49 | size_type i=0; 50 | uint64_t w = (*s >> s_offset); 51 | uint8_t last_bit = w&1; 52 | size_type result = 0; 53 | while (i < bit_length) { 54 | size_type len = 0; 55 | while (last_bit == (w&1) and i < bit_length) { 56 | // std::cout<>= 1; 59 | if (s_offset == 64) { 60 | s_offset = 0; 61 | w = *(++s); 62 | } 63 | } 64 | // std::cout<<"len="< // this enables the use of logical operators ,,and'', ,,or'', ,,not'' 7 | -------------------------------------------------------------------------------- /include/sdsl/config.hpp.cmake: -------------------------------------------------------------------------------- 1 | #ifndef SDSL_CONFIG 2 | #define SDSL_CONFIG 3 | 4 | #define CMAKE_SOURCE_DIR @CMAKE_SOURCE_DIR@ 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /include/sdsl/fast_cache.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef INCLUDED_SDSL_FAST_CACHE 3 | #define INCLUDED_SDSL_FAST_CACHE 4 | 5 | #include "int_vector.hpp" 6 | 7 | namespace sdsl 8 | { 9 | 10 | #define CACHE_SIZE 0x3FFULL 11 | 12 | struct fast_cache { 13 | typedef int_vector<>::size_type size_type; 14 | size_type m_table[2*(CACHE_SIZE+1)]; 15 | // Constructor 16 | fast_cache() { 17 | for (size_type i=0; i < (CACHE_SIZE+1); ++i) { 18 | m_table[i<<1] = (size_type)-1; 19 | } 20 | } 21 | // Returns true if the request i is cached and 22 | // x is set to the answer of request i 23 | bool exists(size_type i, size_type& x) { 24 | if (m_table[(i&CACHE_SIZE)<<1 ] == i) { 25 | x = m_table[((i&CACHE_SIZE)<<1) + 1 ]; 26 | return true; 27 | } else 28 | return false; 29 | } 30 | // Writes the answer for request i to the cache 31 | void write(size_type i, size_type x) { 32 | m_table[(i&CACHE_SIZE)<<1 ] = i; 33 | m_table[((i&CACHE_SIZE)<<1) + 1 ] = x; 34 | } 35 | }; 36 | 37 | } // end namespace sdsl 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/sdsl/isa_construct.hpp: -------------------------------------------------------------------------------- 1 | /* sdsl - succinct data structures library 2 | Copyright (C) 2010 Simon Gog 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see http://www.gnu.org/licenses/ . 16 | */ 17 | /*! \file isa_construct.hpp 18 | \brief isa_construct.hpp contains a space and time efficient construction method for the inverse suffix array 19 | \author Simon Gog 20 | */ 21 | #ifndef INCLUDED_SDSL_ISA_CONSTRUCT 22 | #define INCLUDED_SDSL_ISA_CONSTRUCT 23 | 24 | #include "int_vector.hpp" 25 | #include "util.hpp" 26 | #include "testutils.hpp" 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | namespace sdsl 33 | { 34 | 35 | bool construct_isa(tMSS& file_map, const std::string& dir, const std::string& id); 36 | // TODO methode die den isa auf der bwt berechnet 37 | 38 | }// end namespace 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /include/sdsl/rmq_support.hpp: -------------------------------------------------------------------------------- 1 | /* sdsl - succinct data structures library 2 | Copyright (C) 2009 Simon Gog 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see http://www.gnu.org/licenses/ . 16 | */ 17 | /*! \file rmq_support.hpp 18 | \brief rmq_support.hpp contains different range minimum support data structures. 19 | \author Simon Gog 20 | */ 21 | #ifndef INCLUDED_SDSL_RMQ_SUPPORT 22 | #define INCLUDED_SDSL_RMQ_SUPPORT 23 | 24 | /** \defgroup rmq_group Range Minimum/Maximum Support (RMS) */ 25 | 26 | template // for range minimum queries 27 | struct min_max_trait { 28 | static inline bool strict_compare(const typename RandomAccessContainer::value_type v1, const typename RandomAccessContainer::value_type v2) { 29 | return v1 < v2; 30 | } 31 | static inline bool compare(const typename RandomAccessContainer::value_type v1, const typename RandomAccessContainer::value_type v2) { 32 | return v1 <= v2; 33 | } 34 | }; 35 | 36 | template // for range maximum queries 37 | struct min_max_trait { 38 | static inline bool strict_compare(const typename RandomAccessContainer::value_type v1, const typename RandomAccessContainer::value_type v2) { 39 | return v1 > v2; 40 | } 41 | static inline bool compare(const typename RandomAccessContainer::value_type v1, const typename RandomAccessContainer::value_type v2) { 42 | return v1 >= v2; 43 | } 44 | }; 45 | 46 | #include "rmq_support_sparse_table.hpp" 47 | #include "rmq_succinct_sct.hpp" 48 | #include "rmq_succinct_sada.hpp" 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /include/sdsl/sdsl_concepts.hpp: -------------------------------------------------------------------------------- 1 | /* sdsl - succinct data structures library 2 | Copyright (C) 2010 Simon Gog 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see http://www.gnu.org/licenses/ . 16 | */ 17 | /*! \file suffixarray_helper.hpp 18 | \brief suffixarray_helper.hpp contains some helper classes for (compressed suffix arrays) 19 | \author Simon Gog 20 | */ 21 | #ifndef INCLUDED_SDSL_CONCEPTS 22 | #define INCLUDED_SDSL_CONCEPTS 23 | 24 | namespace sdsl 25 | { 26 | 27 | struct csa_tag {}; 28 | 29 | struct cst_tag {}; 30 | 31 | struct lcp_plain_tag {}; 32 | struct lcp_permuted_tag {}; 33 | struct lcp_tree_compressed_tag {}; 34 | struct lcp_tree_and_lf_compressed_tag {}; 35 | 36 | } // end namespace sdsl 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /include/sdsl/select_support_dummy.hpp: -------------------------------------------------------------------------------- 1 | /* sdsl - succinct data structures library 2 | Copyright (C) 2011 Simon Gog 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see http://www.gnu.org/licenses/ . 16 | */ 17 | /*! \file select_support_dummy.hpp 18 | \brief select_support_dummy.hpp contains classes that support a sdsl::bit_vector with constant time select information. 19 | \author Simon Gog 20 | */ 21 | #ifndef INCLUDED_SDSL_SELECT_SUPPORT_DUMMY 22 | #define INCLUDED_SDSL_SELECT_SUPPORT_DUMMY 23 | 24 | #include "int_vector.hpp" 25 | #include "select_support.hpp" 26 | #include 27 | #include 28 | 29 | //#define SDSL_DEBUG_SELECT_SUPPORT_JMC 30 | 31 | #ifdef SDSL_DEBUG_SELECT_SUPPORT_DUMMY 32 | #include "testutils.hpp" 33 | #endif 34 | 35 | //! Namespace for the succinct data structure library. 36 | namespace sdsl 37 | { 38 | 39 | 40 | //! A dummy class for select 41 | /*! 42 | * @ingroup select_support_group 43 | */ 44 | class select_support_dummy : public select_support 45 | { 46 | public: 47 | select_support_dummy(const int_vector<1>* v=NULL); 48 | select_support_dummy(const select_support_dummy& ss); 49 | ~select_support_dummy(); 50 | void init(const int_vector<1>* v=NULL); 51 | //! Select function 52 | /*! \sa select_support.select 53 | */ 54 | inline const size_type select(size_type i) const; 55 | //! Alias for select(i). 56 | inline const size_type operator()(size_type i)const; 57 | size_type serialize(std::ostream& out, structure_tree_node* v=NULL, std::string name="")const; 58 | void load(std::istream& in, const int_vector<1>* v=NULL); 59 | void set_vector(const int_vector<1>* v=NULL); 60 | select_support_dummy& operator=(const select_support_dummy& ss); 61 | 62 | //! Swap operator 63 | void swap(select_support_dummy& ss); 64 | //! Equality Operator 65 | /*! Two select_support_dummys are equal if all member variables are equal. 66 | * Required for the Equality Comparable Concept of the STL. 67 | * \sa operator!= 68 | */ 69 | bool operator==(const select_support_dummy& ss)const; 70 | //! Unequality Operator 71 | bool operator!=(const select_support_dummy& ss)const; 72 | }; 73 | 74 | 75 | 76 | } 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /include/sdsl/suffixarrays.hpp: -------------------------------------------------------------------------------- 1 | /* sdsl - succinct data structures library 2 | Copyright (C) 2008 Simon Gog 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see http://www.gnu.org/licenses/ . 16 | */ 17 | /*! \file suffixarrays.hpp 18 | \brief suffixarrays.hpp contains generic classes for different suffix array classes. 19 | \author Simon Gog 20 | */ 21 | #ifndef INCLUDED_SDSL_SUFFIXARRAYS 22 | #define INCLUDED_SDSL_SUFFIXARRAYS 23 | 24 | #include "sdsl_concepts.hpp" 25 | 26 | /** \defgroup csa Compressed Suffix Arrays (CSA) */ 27 | 28 | #include "csa_uncompressed.hpp" 29 | #include "csa_wt.hpp" 30 | #include "csa_sada_theo.hpp" 31 | #include "csa_sada.hpp" 32 | #include "csa_construct.hpp" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /include/sdsl/tikz.hpp: -------------------------------------------------------------------------------- 1 | //! Author: Simon Gog (simon.gog@unimelb.edu.au) 2 | 3 | #ifndef INCLUDED_SDSL_TIKZ 4 | #define INCLUDED_SDSL_TIKZ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using std::string; 12 | using std::ostream; 13 | using std::endl; 14 | 15 | namespace sdsl 16 | { 17 | 18 | void begin_tikzpicture(ostream& out, string options=""); 19 | void end_tikzpicture(ostream& out); 20 | void begin_tikzscope(ostream& out, string options=""); 21 | void end_tikzscope(ostream& out); 22 | void tikz_node(ostream& out, string content="", string at="0,0", string name="", string options=""); 23 | void tikz_coordinate(ostream& out, string at="0,0", string name="", string option=""); 24 | 25 | template 26 | void write_tikz_column_from_container(ostream& out, const T& vec, string name_prefix="i") 27 | { 28 | tikz_node(out, "", "0,0cm", name_prefix, "st_"+name_prefix); 29 | for (typename T::size_type i=0; i < vec.size(); ++i) { 30 | tikz_node(out, util::to_latex_string(vec[i]), name_prefix + "|- y" + util::to_string(i) , 31 | name_prefix+util::to_string(i), "st_elem_"+name_prefix); 32 | } 33 | } 34 | 35 | template 36 | void write_tikz_array(ostream& out, const tContainer& v, string array_name="", bool escape=false) 37 | { 38 | if (array_name != "") { 39 | out << "\\def\\" << array_name << "{%" << endl; 40 | } else { 41 | out << "{"; 42 | } 43 | for (typename tContainer::size_type i=0; i < v.size(); ++i) { 44 | if (i > 0) 45 | out << ","; 46 | string w = util::to_latex_string(v[i]); 47 | if (escape) { 48 | if (w.size() > 0 and w[0]=='\\') 49 | w = "\\noexpand"+w; 50 | out << "\"" << w << "\""; 51 | } else { 52 | out << w; 53 | } 54 | } 55 | out << "}"; 56 | if (array_name != "") { 57 | out << "%" << endl; 58 | } 59 | } 60 | 61 | void write_y_column(ostream& out, size_t n); 62 | 63 | } // end namespace 64 | #endif 65 | -------------------------------------------------------------------------------- /include/sdsl/typedefs.hpp: -------------------------------------------------------------------------------- 1 | /*! This files includes typedef of stl data types 2 | * \file typedefs.hpp contains typedefs for some data structures composed of stl data types 3 | */ 4 | #ifndef INCLUDED_SDSL_TYPEDEFS 5 | #define INCLUDED_SDSL_TYPEDEFS 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace sdsl 12 | { 13 | 14 | typedef std::map tMSS; 15 | typedef std::vector tVS; 16 | 17 | } 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /include/sdsl/uint128_t.hpp: -------------------------------------------------------------------------------- 1 | /* sdsl - succinct data structures library 2 | Copyright (C) 2012 Simon Gog, Matthias Petri 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see http://www.gnu.org/licenses/ . 16 | */ 17 | /*! \file uint128_t.hpp 18 | \brief uint128_t.hpp contains contains the definition of a 128-bit unsigned integer type. 19 | \author Simon Gog, Matthias Petri 20 | */ 21 | #ifndef INCLUDED_SDSL_UINT128 22 | #define INCLUDED_SDSL_UINT128 23 | 24 | #include 25 | #include "bitmagic.hpp" 26 | 27 | namespace sdsl 28 | { 29 | 30 | typedef unsigned int uint128_t __attribute__((mode(TI))); 31 | 32 | inline 33 | std::ostream& operator<<(std::ostream& os, const uint128_t& x) 34 | { 35 | uint64_t X[2] = {(uint64_t)(x >> 64), (uint64_t)x}; 36 | for (int j=0; j < 2; ++j) { 37 | for (int i=0; i < 16; ++i) { 38 | os << std::hex << ((X[j]>>60)&0xFULL); 39 | X[j] <<= 4; 40 | } 41 | } 42 | return os; 43 | } 44 | 45 | 46 | } // end namespace 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/sdsl/uintx_t.hpp.cmake: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_SDSL_UINTX_T 2 | #define INCLUDED_SDSL_UINTX_T 3 | 4 | // for uint64_t and uint32_t declaration 5 | @INTINCFILE@ 6 | 7 | 8 | //TODO: the lack of a stdin.h http://www.azillionmonkeys.com/qed/pstdint.h 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /include/sdsl/vectors.hpp: -------------------------------------------------------------------------------- 1 | /** \defgroup int_vector int_vector */ 2 | 3 | #include "int_vector.hpp" 4 | #include "enc_vector.hpp" 5 | #include "enc_vector_theo.hpp" 6 | #include "enc_vector_dna.hpp" 7 | -------------------------------------------------------------------------------- /include/sdsl/wavelet_trees.hpp: -------------------------------------------------------------------------------- 1 | /* sdsl - succinct data structures library 2 | Copyright (C) 2011 Simon Gog 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see http://www.gnu.org/licenses/ . 16 | */ 17 | /*! \file wavelet_trees.hpp 18 | \brief wavelet_trees.hpp contains wavelet tree implementations. 19 | \author Simon Gog 20 | */ 21 | #ifndef INCLUDED_SDSL_WAVELET_TREES 22 | #define INCLUDED_SDSL_WAVELET_TREES 23 | 24 | /** \defgroup wt Wavelet Trees (WT) 25 | * This group contains data structures for wavelet trees. The following methods are supported: 26 | * - []-operator 27 | * - rank(i, c) 28 | * - select(i, c) 29 | * - rank_ith_symbol(i) 30 | */ 31 | 32 | #include "wt.hpp" 33 | #include "wt_int.hpp" 34 | #include "wt_huff.hpp" 35 | #include "wt_rlmn.hpp" 36 | #include "wt_rlg.hpp" 37 | #include "wt_rlg8.hpp" 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/sdsl/wt_helper.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_SDSL_WT_HELPER 2 | #define INCLUDED_SDSL_WT_HELPER 3 | 4 | #include "int_vector.hpp" 5 | 6 | namespace sdsl 7 | { 8 | 9 | const uint16_t _undef_node = 65535; 10 | 11 | //! Count for each character in [0..255] the number of occurences in rac[0..size-1] 12 | /*! 13 | * \return C An array of size 256, which contains for each character the number of occurences in rac[0..size-1] 14 | */ 15 | template 16 | void calculate_character_occurences(int_vector_file_buffer<8, size_type_class>& text, const size_type size, size_type* C) 17 | { 18 | text.reset(); 19 | if (text.int_vector_size < size) { 20 | throw std::logic_error("calculate_character_occurences: stream size is smaller than size!"); 21 | return; 22 | } 23 | for (size_type i=0, r_sum=0, r = text.load_next_block(); r_sum < size;) { 24 | if (r_sum + r > size) { // read not more than size chars in the next loop 25 | r = size-r_sum; 26 | } 27 | for (; i < r_sum+r; ++i) { 28 | ++C[text[i-r_sum]]; 29 | } 30 | r_sum += r; r = text.load_next_block(); 31 | } 32 | } 33 | 34 | template 35 | void calculate_effective_alphabet_size(const size_type* C, size_type& sigma) 36 | { 37 | sigma = 0; // initialize with 0 38 | for (size_type i=0; i < 256; ++i) // for all possible symbols 39 | if (C[i] > 0) // increase sigma, if it 40 | ++sigma; // exists in the text 41 | } 42 | 43 | } // end namespace sdsl 44 | #endif 45 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script builds all dependencies of sdsl 3 | # and installs the library on a LINUX or Mac OS X system 4 | 5 | SDSL_INSTALL_PREFIX=${HOME} 6 | if [[ $# -ge 1 ]]; then 7 | SDSL_INSTALL_PREFIX=${1} 8 | echo "Library will be installed in ${1}" 9 | fi 10 | 11 | 12 | sufsort_dir="libdivsufsort-2.0.1" 13 | gtest_dir="gtest-1.6.0" 14 | 15 | # (1) Install libdivsufsort-2.0.1 16 | OLD_DIR="$( cd "$( dirname "$0" )" && pwd )" # gets the directory where the script is located in 17 | cd "${OLD_DIR}" 18 | 19 | cd "${sufsort_dir}/build" # step into the build dir of libdivsufsort 20 | 21 | cmake -DCMAKE_INSTALL_PREFIX=${SDSL_INSTALL_PREFIX} -DBUILD_DIVSUFSORT64=ON \ 22 | -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE="Release" -DBUILD_EXAMPLES=OFF .. # run cmake 23 | make # run make 24 | 25 | if [[ ! -d "${SDSL_INSTALL_PREFIX}/include" ]]; then # if there exists not include dir 26 | mkdir "${SDSL_INSTALL_PREFIX}/include" # try to create one 27 | fi 28 | if [[ ! -d "${SDSL_INSTALL_PREFIX}/lib" ]]; then #if there exits no lib dir 29 | mkdir "${SDSL_INSTALL_PREFIX}/lib" 30 | fi 31 | make install # install libdivsufsort 32 | 33 | cd ../.. # go to the original directory 34 | if [[ `pwd` != ${OLD_DIR} ]]; then 35 | echo "ERROR: we are not in the original dir ${OLD_DIR} now." 36 | exit 1 37 | fi 38 | echo "SUCCESS: Yuta Mori's libdivsufsort was installed successfully!" 39 | rm -rf "${sufsort_dir}/build/*" 40 | # (2) Install gtest 41 | 42 | cd "${gtest_dir}/build" # step into the build dir of gtest 43 | 44 | # (3) Finally, install sdsl 45 | cmake -DCMAKE_INSTALL_PREFIX=${SDSL_INSTALL_PREFIX} \ 46 | -DBUILD_SHARED_LIBS=OFF -Dgtest_disable_pthreads=ON .. 47 | make # run make 48 | cp ./libgtest* "${SDSL_INSTALL_PREFIX}/lib" # copy generated libraries to the destination 49 | cp -r ../include/gtest "${SDSL_INSTALL_PREFIX}/include" 50 | 51 | cd ../.. # go to the original directory 52 | if [[ `pwd` != ${OLD_DIR} ]]; then 53 | echo "ERROR: we are not in the original dir ${OLD_DIR} now." 54 | exit 1 55 | fi 56 | echo "SUCCESS: gtest was installed successfully!" 57 | #rm -rf "${sufsort_dir}/build/*" 58 | 59 | 60 | cd build # change into the build directory 61 | if [[ $? != 0 ]]; then 62 | exit 1 63 | fi 64 | 65 | cmake -DCMAKE_INSTALL_PREFIX=${SDSL_INSTALL_PREFIX} .. # run cmake 66 | make # run make 67 | make install # install library 68 | 69 | cd .. 70 | 71 | if [[ `pwd` != ${OLD_DIR} ]]; then 72 | echo "ERROR: we are not in the original dir ${OLD_DIR} now." 73 | exit 1 74 | fi 75 | 76 | echo "SUCCESS: sdsl was installed successfully!" 77 | echo "The sdsl include files are located in ${SDSL_INSTALL_PREFIX}/include." 78 | echo "The library files are located in ${SDSL_INSTALL_PREFIX}/lib." 79 | echo " " 80 | echo "Sample programs can be found in the examples-directory." 81 | echo "Test cases in the test-directory" 82 | echo "A program 'example.cpp' can be compiled with the command: " 83 | echo "g++ -DNDEBUG -O3 [-msse4.2] \\" 84 | echo " -I${SDSL_INSTALL_PREFIX}/include -L${SDSL_INSTALL_PREFIX}/lib \\" 85 | echo " example.cpp -lsdsl -ldivsufsort -ldivsufsort64" 86 | echo " " 87 | echo "Tests can be found in the test-directory." 88 | echo "Have fun!" 89 | -------------------------------------------------------------------------------- /lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(#"${CMAKE_CURRENT_SOURCE_DIR}/../include" 2 | "${CMAKE_CURRENT_BINARY_DIR}/../include" 3 | "${divsufsort_INCLUDE_DIRS}" 4 | "${divsufsort64_INCLUDE_DIRS}" 5 | ) 6 | 7 | 8 | file(GLOB libFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") # select all .cpp-files 9 | 10 | set( sdsl_SRCS ${libFiles} ) 11 | 12 | add_library( sdsl ${sdsl_SRCS} ) 13 | 14 | install(TARGETS sdsl 15 | RUNTIME DESTINATION bin 16 | LIBRARY DESTINATION lib 17 | ARCHIVE DESTINATION lib) 18 | 19 | set_target_properties(sdsl PROPERTIES 20 | VERSION "${LIBRARY_VERSION_FULL}" 21 | SOVERSION "${LIBRARY_VERSION_MAJOR}" 22 | # DEFINE_SYMBOL SDSL_BUILD_DLL 23 | # RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../examples" 24 | ) 25 | -------------------------------------------------------------------------------- /lib/algorithms.cpp: -------------------------------------------------------------------------------- 1 | /* sdsl - succinct data structures library 2 | Copyright (C) 2008 Simon Gog 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see http://www.gnu.org/licenses/ . 16 | */ 17 | #include "sdsl/algorithms.hpp" 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | typedef std::map tMSS; 24 | 25 | namespace sdsl 26 | { 27 | 28 | double algorithm::H_0(const unsigned char* c) 29 | { 30 | size_t n = strlen((const char*)c); 31 | if (n==0) 32 | return 0; 33 | size_t cnt[256] = {}; 34 | double res = 0; 35 | for (size_t i=0; i0) { 39 | res += (double)cnt[i]/(double)n * log2((double)n/(double)cnt[i]); 40 | // std::cerr<<"cnt["<0; 20 | if (i > 0 and cnt_c[i] < cnt_c[min_cnt]) 21 | min_cnt = i; 22 | } 23 | if (cnt_cc == 256) { 24 | std::cerr << "# ERROR: Alphabet size>255!!!" << std::endl; 25 | std::cerr << "min_cnt = "<< min_cnt << " C[min_cnt]="<< cnt_c[min_cnt] << std::endl; 26 | for (uint64_t i=0; i::size_type size_type; 12 | // TODO: bei csa_uncompressed ist die Berechnung des isa nicht notwendig; die Speicherung schon 13 | if (file_map.find("isa") == file_map.end()) { // if isa is not already on disk => calculate it 14 | write_R_output("cst", "construct ISA", "begin", 1, 0); 15 | int_vector<> isa; 16 | if (!util::load_from_file(isa, file_map["sa"].c_str())) { 17 | throw std::ios_base::failure("cst_construct: Cannot load SA from file system!"); 18 | } 19 | { 20 | int_vector_file_buffer<> sa_buf(file_map["sa"].c_str()); 21 | 22 | for (size_type i=0, r_sum=0, r = sa_buf.load_next_block(); r_sum < isa.size();) { 23 | for (; i isa2(isa.size()); 38 | isa.resize(0); 39 | write_R_output("cst", "construct ISA2", "begin", 1, 0); 40 | { 41 | int_vector_file_buffer<> sa_buf(file_map["sa"].c_str()); 42 | 43 | for(size_type i=0, r_sum=0, r = sa_buf.load_next_block(); r_sum < isa2.size(); ){ 44 | for(; i* v) { } 7 | 8 | select_support_dummy::select_support_dummy(const int_vector<1>* v):select_support(v) 9 | { 10 | init(v); 11 | } 12 | 13 | 14 | select_support_dummy::select_support_dummy(const select_support_dummy& ss):select_support(ss.m_v) 15 | { 16 | } 17 | 18 | 19 | select_support_dummy& select_support_dummy::operator=(const select_support_dummy& ss) 20 | { 21 | return *this; 22 | } 23 | 24 | 25 | void select_support_dummy::swap(select_support_dummy& ss) 26 | { 27 | } 28 | 29 | 30 | select_support_dummy::~select_support_dummy() { } 31 | 32 | 33 | 34 | void select_support_dummy::init(const int_vector<1>* v) { } 35 | 36 | 37 | const select_support_dummy::size_type select_support_dummy::select(size_type i)const 38 | { 39 | throw std::logic_error("select_dummy does not implement select"); 40 | return 0; 41 | } 42 | 43 | 44 | const select_support_dummy::size_type select_support_dummy::operator()(size_type i)const 45 | { 46 | return select(i); 47 | } 48 | 49 | void select_support_dummy::set_vector(const int_vector<1>* v) { } 50 | 51 | select_support_dummy::size_type select_support_dummy::serialize(std::ostream& out, structure_tree_node* v, std::string name)const 52 | { 53 | structure_tree_node* child = structure_tree::add_child(v, name, util::class_name(*this)); 54 | structure_tree::add_size(child, 0); 55 | return 0; 56 | } 57 | 58 | void select_support_dummy::load(std::istream& in, const int_vector<1>* v) { } 59 | 60 | bool select_support_dummy::operator==(const select_support_dummy& ss)const 61 | { 62 | return true; 63 | } 64 | 65 | bool select_support_dummy::operator!=(const select_support_dummy& ss)const 66 | { 67 | return !(*this == ss); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /lib/test_index_performance.cpp: -------------------------------------------------------------------------------- 1 | #include "sdsl/test_index_performance.hpp" 2 | 3 | namespace sdsl 4 | { 5 | 6 | int_vector<64> get_rnd_positions(uint8_t log_s, uint64_t& mask, uint64_t mod, uint64_t seed) 7 | { 8 | mask = (1< rands(1<0) { 12 | util::all_elements_mod(rands, mod); 13 | } 14 | return rands; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /lib/tikz.cpp: -------------------------------------------------------------------------------- 1 | #include "sdsl/tikz.hpp" 2 | 3 | namespace sdsl 4 | { 5 | 6 | void begin_tikzpicture(ostream& out, string options) 7 | { 8 | out << "\\begin{tikzpicture}[" << options << "]%\n" << endl; 9 | } 10 | 11 | void end_tikzpicture(ostream& out) 12 | { 13 | out << "\\end{tikzpicture}%\n" << endl; 14 | } 15 | 16 | void begin_tikzscope(ostream& out, string options) 17 | { 18 | out << "\\begin{scope}[" << options << "]\n" << endl; 19 | } 20 | 21 | void end_tikzscope(ostream& out) 22 | { 23 | out << "\\end{scope}%\n" << endl; 24 | } 25 | 26 | void tikz_node(ostream& out, string content, string at, string name, string options) 27 | { 28 | out<< "\\node[" << options << "] (" << name << ") at ("<< at <<") {" << content << "};%\n"; 29 | } 30 | 31 | void tikz_coordinate(ostream& out, string at, string name, string option) 32 | { 33 | out<< "\\coordinate[" << option << "] (" << name << ")"; 34 | if (at != "") 35 | out <<" at ("<< at <<")"; 36 | out << ";%\n"; 37 | } 38 | 39 | void write_y_column(ostream& out, size_t n) 40 | { 41 | begin_tikzscope(out, "st_y"); 42 | tikz_coordinate(out, "0,0", "y0"); 43 | for (size_t i=1; i 4 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/CMakeModules/AppendCompilerFlags.cmake: -------------------------------------------------------------------------------- 1 | include(CheckCSourceCompiles) 2 | include(CheckCXXSourceCompiles) 3 | 4 | macro(append_c_compiler_flags _flags _name _result) 5 | set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) 6 | string(REGEX REPLACE "[-+/ ]" "_" cname "${_name}") 7 | string(TOUPPER "${cname}" cname) 8 | foreach(flag ${_flags}) 9 | string(REGEX REPLACE "^[-+/ ]+(.*)[-+/ ]*$" "\\1" flagname "${flag}") 10 | string(REGEX REPLACE "[-+/ ]" "_" flagname "${flagname}") 11 | string(TOUPPER "${flagname}" flagname) 12 | set(have_flag "HAVE_${cname}_${flagname}") 13 | set(CMAKE_REQUIRED_FLAGS "${flag}") 14 | check_c_source_compiles("int main() { return 0; }" ${have_flag}) 15 | if(${have_flag}) 16 | set(${_result} "${${_result}} ${flag}") 17 | endif(${have_flag}) 18 | endforeach(flag) 19 | set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS}) 20 | endmacro(append_c_compiler_flags) 21 | 22 | macro(append_cxx_compiler_flags _flags _name _result) 23 | set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) 24 | string(REGEX REPLACE "[-+/ ]" "_" cname "${_name}") 25 | string(TOUPPER "${cname}" cname) 26 | foreach(flag ${_flags}) 27 | string(REGEX REPLACE "^[-+/ ]+(.*)[-+/ ]*$" "\\1" flagname "${flag}") 28 | string(REGEX REPLACE "[-+/ ]" "_" flagname "${flagname}") 29 | string(TOUPPER "${flagname}" flagname) 30 | set(have_flag "HAVE_${cname}_${flagname}") 31 | set(CMAKE_REQUIRED_FLAGS "${flag}") 32 | check_cxx_source_compiles("int main() { return 0; }" ${have_flag}) 33 | if(${have_flag}) 34 | set(${_result} "${${_result}} ${flag}") 35 | endif(${have_flag}) 36 | endforeach(flag) 37 | set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS}) 38 | endmacro(append_cxx_compiler_flags) 39 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/CMakeModules/CheckFunctionKeywords.cmake: -------------------------------------------------------------------------------- 1 | include(CheckCSourceCompiles) 2 | 3 | macro(check_function_keywords _wordlist) 4 | set(${_result} "") 5 | foreach(flag ${_wordlist}) 6 | string(REGEX REPLACE "[-+/ ()]" "_" flagname "${flag}") 7 | string(TOUPPER "${flagname}" flagname) 8 | set(have_flag "HAVE_${flagname}") 9 | check_c_source_compiles("${flag} void func(); void func() { } int main() { func(); return 0; }" ${have_flag}) 10 | if(${have_flag} AND NOT ${_result}) 11 | set(${_result} "${flag}") 12 | # break() 13 | endif(${have_flag} AND NOT ${_result}) 14 | endforeach(flag) 15 | endmacro(check_function_keywords) 16 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/CMakeModules/ProjectCPack.cmake: -------------------------------------------------------------------------------- 1 | # If the cmake version includes cpack, use it 2 | IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") 3 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}") 4 | SET(CPACK_PACKAGE_VENDOR "${PROJECT_VENDOR}") 5 | SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") 6 | SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") 7 | SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") 8 | SET(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") 9 | SET(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") 10 | # SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${PROJECT_VERSION}") 11 | SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION_FULL}") 12 | 13 | IF(NOT DEFINED CPACK_SYSTEM_NAME) 14 | SET(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") 15 | ENDIF(NOT DEFINED CPACK_SYSTEM_NAME) 16 | 17 | IF(${CPACK_SYSTEM_NAME} MATCHES Windows) 18 | IF(CMAKE_CL_64) 19 | SET(CPACK_SYSTEM_NAME win64-${CMAKE_SYSTEM_PROCESSOR}) 20 | ELSE(CMAKE_CL_64) 21 | SET(CPACK_SYSTEM_NAME win32-${CMAKE_SYSTEM_PROCESSOR}) 22 | ENDIF(CMAKE_CL_64) 23 | ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows) 24 | 25 | IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME) 26 | SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}") 27 | ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME) 28 | 29 | SET(CPACK_PACKAGE_CONTACT "${PROJECT_CONTACT}") 30 | IF(UNIX) 31 | SET(CPACK_STRIP_FILES "") 32 | SET(CPACK_SOURCE_STRIP_FILES "") 33 | # SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake") 34 | ENDIF(UNIX) 35 | SET(CPACK_SOURCE_IGNORE_FILES "/CVS/" "/build/" "/\\\\.build/" "/\\\\.svn/" "~$") 36 | # include CPack model once all variables are set 37 | INCLUDE(CPack) 38 | ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") 39 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/CMakeModules/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 3 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | STRING(REGEX REPLACE "\n" ";" files "${files}") 7 | 8 | SET(NUM 0) 9 | FOREACH(file ${files}) 10 | IF(EXISTS "$ENV{DESTDIR}${file}") 11 | MESSAGE(STATUS "Looking for \"$ENV{DESTDIR}${file}\" - found") 12 | SET(UNINSTALL_CHECK_${NUM} 1) 13 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 14 | MESSAGE(STATUS "Looking for \"$ENV{DESTDIR}${file}\" - not found") 15 | SET(UNINSTALL_CHECK_${NUM} 0) 16 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 17 | MATH(EXPR NUM "1 + ${NUM}") 18 | ENDFOREACH(file) 19 | 20 | SET(NUM 0) 21 | FOREACH(file ${files}) 22 | IF(${UNINSTALL_CHECK_${NUM}}) 23 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 24 | EXEC_PROGRAM( 25 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 26 | OUTPUT_VARIABLE rm_out 27 | RETURN_VALUE rm_retval 28 | ) 29 | IF(NOT "${rm_retval}" STREQUAL 0) 30 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 31 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 32 | ENDIF(${UNINSTALL_CHECK_${NUM}}) 33 | MATH(EXPR NUM "1 + ${NUM}") 34 | ENDFOREACH(file) 35 | 36 | FILE(REMOVE "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 37 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/COPYING: -------------------------------------------------------------------------------- 1 | The libdivsufsort copyright is as follows: 2 | 3 | Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | 26 | See also the libdivsufsort web site: 27 | http://libdivsufsort.googlecode.com/ for more information. 28 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/ChangeLog.old: -------------------------------------------------------------------------------- 1 | Version 1.0.2 (2006-01-01): 2 | 3 | * Release 1.0.2 4 | 5 | Version 1.0.2b (2005-12-11): 6 | 7 | * lib/divsufsort.c (_construct_typeBstar): Completely rewrite. 8 | 9 | Version 1.0.2a (2005-12-04): 10 | 11 | * lib/substringsort.c: Completely rewrite. 12 | * lib/drsort.c: Completely rewrite. 13 | * lib/divsufsort.c (_sort_typeBstar): Fix some bugs. 14 | 15 | Version 1.0.1 (2005-11-08): 16 | 17 | * Release 1.0.1 18 | 19 | Version 1.0.1a (2005-11-06): 20 | 21 | * configure.ac: Add AM_ENABLE_STATIC, AM_DISABLE_SHARED and AC_LIBTOOL_WIN32_DLL 22 | 23 | * Makefile.am (EXTRA_DIST): Add ChangeLog.old. 24 | 25 | * lib/divsufsort.c (_construct_typeBstar): Fix. 26 | 27 | * AUTHORS: New file. 28 | * ChangeLog: New file. 29 | * ChangeLog.old: New file. 30 | * INSTALL: New file. 31 | * NEWS: New file. 32 | 33 | Version 1.0.0 (2005-10-31) 34 | * Introduced autoconf and automake. 35 | * Added new example programs. 36 | 37 | Version 0.2.1 (2005-08-27) 38 | * divsufsort.c: Kao's algorithm was replaced with Improved Two-Stage algorithm. 39 | * divsufsort.c: Reduced memory usage. 40 | * substringsort.c: Added mergesort for sorting large groups of suffixes. 41 | 42 | Version 0.1.6 (2005-06-10) 43 | * divsufsort.h: Renamed from libdivsufsort.h. (again...) 44 | * divsufsort.c: Renamed from libdivsufsort.c. (again...) 45 | * divsufsort.c: Reduced memory usage. 46 | * substringsort.c, substringsort.h, drsort.c, drsort.h: Modify. 47 | * mksary_mmap/makefile, mksary_mmap/mksary.c, 48 | mksary_mmap/mmap.c, mksary_mmap/mmap.h: Removed. 49 | 50 | Version 0.1.5 (2005-04-07) 51 | * libdivsufsort.c: ranksort and doublingsort were replaced with drsort. 52 | * def.h, drsort.c, drsort.h: New file. 53 | * doublingsort.c, doublingsort.h, ranksort.c, ranksort.h: Removed. 54 | 55 | Version 0.1.4 (2005-03-27) 56 | * mksary/mksary.c, mksary_mmap/mksary.c, suftest.c: Added error handling. 57 | 58 | Version 0.1.3 (2005-01-28) 59 | * mksary/makefile, mksary/mksary.c, mksary_mmap/makefile, 60 | mksary_mmap/mksary.c, mksary_mmap/mmap.c, mksary_mmap/mmap.h: New file. 61 | * libdivsufsort.c: Modify. 62 | 63 | Version 0.1.2 (2005-01-01) 64 | * suftest.c: New file. 65 | * libdivsufsort.c: Renamed from divsufsort.c. 66 | * libdivsufsort.h: Renamed from divsufsort.h. 67 | 68 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/INSTALL: -------------------------------------------------------------------------------- 1 | -- INSTALL for libdivsufsort 2 | 3 | 4 | Requirements: 5 | ============= 6 | 7 | * CMake version 2.4.2 or newer (http://www.cmake.org/) 8 | * An ANSI C compiler 9 | * GNU Make 10 | 11 | 12 | Compilation and Installation (with Unix Makefiles): 13 | =================================================== 14 | 15 | 1. Create a 'build' directory in the package source directory. 16 | 17 | $ cd libdivsufsort-?.?.? 18 | $ mkdir build 19 | $ cd build 20 | 21 | 2. Configure the package for your system. 22 | 23 | $ cmake -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="/usr/local" .. 24 | 25 | 3. Compile the package. 26 | 27 | $ make 28 | 29 | 4. Install the library and header files. 30 | 31 | # make install 32 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libdivsufsort 2 | 3 | SUBDIRS = include lib examples 4 | 5 | EXTRA_DIST = ChangeLog.old CMakeLists.txt VERSION CMakeModules pkgconfig 6 | 7 | ACLOCAL_AMFLAGS = -I m4 8 | 9 | libtool: $(LIBTOOL_DEPS) 10 | $(SHELL) ./config.status --recheck 11 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/NEWS: -------------------------------------------------------------------------------- 1 | -- NEWS for libdivsufsort 2 | 3 | Changes in release 2.0.0 4 | 5 | - The build system was changed to CMake. (http://www.cmake.org/) 6 | - Improved the performance of the suffix-sorting algorithm. 7 | - Added OpenMP support. 8 | - Added 64-bit version of divsufsort. 9 | 10 | Changes in release 1.2.3 11 | 12 | - Bug fixes. 13 | 14 | Changes in release 1.2.2 15 | 16 | - An important bug fix. 17 | 18 | Changes in release 1.2.1 19 | 20 | - A few bug fixes. 21 | - New APIs: sa_search, sa_simplesearch. 22 | 23 | Changes in release 1.2.0 24 | 25 | - Changed license to the MIT/X11 license, see COPYING. 26 | - Improved the performance of the suffix array construction. 27 | - Change to use a new improved two-stage sorting algorithm. 28 | - Replace substringsort with a new sorting algorithm that uses 29 | multikey introspective sorting algorithm and in-place/recursive 30 | merging algorithm. 31 | - Replace drsort with a new sorting algorithm that uses 32 | multikey introspective sorting algorithm, Maniscalco's tandem 33 | repeat sorting algorithm and Larsson-Sadakane sorting algorithm. 34 | - New API: divbwt. 35 | 36 | Changes in release 1.0.2 37 | 38 | - The performance of sorting has been improved. 39 | - Fix some bugs. 40 | 41 | Changes in release 1.0.1 42 | 43 | - The performance of sorting has been improved a little bit. 44 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/VERSION: -------------------------------------------------------------------------------- 1 | 2.0.1 2 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/build/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## Add definitions ## 2 | add_definitions(-D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64) 3 | 4 | ## Targets ## 5 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include" 6 | "${CMAKE_CURRENT_BINARY_DIR}/../include") 7 | link_directories("${CMAKE_CURRENT_BINARY_DIR}/../lib") 8 | foreach(src suftest mksary sasearch bwt unbwt) 9 | add_executable(${src} ${src}.c) 10 | target_link_libraries(${src} divsufsort) 11 | endforeach(src) 12 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/examples/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libdivsufsort 2 | 3 | noinst_PROGRAMS = suftest mksary sasearch bwt unbwt 4 | LDADD = $(top_builddir)/lib/libdivsufsort.la 5 | 6 | EXTRA_DIST = CMakeLists.txt 7 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/include/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libdivsufsort 2 | 3 | nodist_include_HEADERS = divsufsort.h 4 | if DIVSUFSORT64 5 | nodist_include_HEADERS += divsufsort64.h 6 | endif 7 | EXTRA_DIST = divsufsort_private.h divsufsort.h.cmake divsufsort64.h.in config.h.cmake CMakeLists.txt lfs.h.cmake 8 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/include/config.h.cmake: -------------------------------------------------------------------------------- 1 | /* 2 | * config.h for libdivsufsort 3 | * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef _CONFIG_H 28 | #define _CONFIG_H 1 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif /* __cplusplus */ 33 | 34 | /** Define to the version of this package. **/ 35 | #cmakedefine PROJECT_VERSION_FULL "${PROJECT_VERSION_FULL}" 36 | 37 | /** Define to 1 if you have the header files. **/ 38 | #cmakedefine HAVE_INTTYPES_H 1 39 | #cmakedefine HAVE_STDDEF_H 1 40 | #cmakedefine HAVE_STDINT_H 1 41 | #cmakedefine HAVE_STDLIB_H 1 42 | #cmakedefine HAVE_STRING_H 1 43 | #cmakedefine HAVE_STRINGS_H 1 44 | #cmakedefine HAVE_MEMORY_H 1 45 | #cmakedefine HAVE_SYS_TYPES_H 1 46 | 47 | /** for WinIO **/ 48 | #cmakedefine HAVE_IO_H 1 49 | #cmakedefine HAVE_FCNTL_H 1 50 | #cmakedefine HAVE__SETMODE 1 51 | #cmakedefine HAVE_SETMODE 1 52 | #cmakedefine HAVE__FILENO 1 53 | #cmakedefine HAVE_FOPEN_S 1 54 | #cmakedefine HAVE__O_BINARY 1 55 | #ifndef HAVE__SETMODE 56 | # if HAVE_SETMODE 57 | # define _setmode setmode 58 | # define HAVE__SETMODE 1 59 | # endif 60 | # if HAVE__SETMODE && !HAVE__O_BINARY 61 | # define _O_BINARY 0 62 | # define HAVE__O_BINARY 1 63 | # endif 64 | #endif 65 | 66 | /** for inline **/ 67 | #ifndef INLINE 68 | # define INLINE @INLINE@ 69 | #endif 70 | 71 | /** for VC++ warning **/ 72 | #ifdef _MSC_VER 73 | #pragma warning(disable: 4127) 74 | #endif 75 | 76 | 77 | #ifdef __cplusplus 78 | } /* extern "C" */ 79 | #endif /* __cplusplus */ 80 | 81 | #endif /* _CONFIG_H */ 82 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/include/lfs.h.cmake: -------------------------------------------------------------------------------- 1 | /* 2 | * lfs.h for libdivsufsort 3 | * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef _LFS_H 28 | #define _LFS_H 1 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif /* __cplusplus */ 33 | 34 | #ifndef __STRICT_ANSI__ 35 | # define LFS_OFF_T @LFS_OFF_T@ 36 | # define LFS_FOPEN @LFS_FOPEN@ 37 | # define LFS_FTELL @LFS_FTELL@ 38 | # define LFS_FSEEK @LFS_FSEEK@ 39 | # define LFS_PRId @LFS_PRID@ 40 | #else 41 | # define LFS_OFF_T long 42 | # define LFS_FOPEN fopen 43 | # define LFS_FTELL ftell 44 | # define LFS_FSEEK fseek 45 | # define LFS_PRId "ld" 46 | #endif 47 | #ifndef PRIdOFF_T 48 | # define PRIdOFF_T LFS_PRId 49 | #endif 50 | 51 | 52 | #ifdef __cplusplus 53 | } /* extern "C" */ 54 | #endif /* __cplusplus */ 55 | 56 | #endif /* _LFS_H */ 57 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include" 2 | "${CMAKE_CURRENT_BINARY_DIR}/../include") 3 | 4 | set(divsufsort_SRCS divsufsort.c sssort.c trsort.c utils.c) 5 | 6 | ## libdivsufsort ## 7 | add_library(divsufsort ${divsufsort_SRCS}) 8 | install(TARGETS divsufsort 9 | RUNTIME DESTINATION bin 10 | LIBRARY DESTINATION lib 11 | ARCHIVE DESTINATION lib) 12 | set_target_properties(divsufsort PROPERTIES 13 | VERSION "${LIBRARY_VERSION_FULL}" 14 | SOVERSION "${LIBRARY_VERSION_MAJOR}" 15 | DEFINE_SYMBOL DIVSUFSORT_BUILD_DLL 16 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../examples") 17 | 18 | ## libdivsufsort64 ## 19 | if(BUILD_DIVSUFSORT64) 20 | add_library(divsufsort64 ${divsufsort_SRCS}) 21 | install(TARGETS divsufsort64 22 | RUNTIME DESTINATION bin 23 | LIBRARY DESTINATION lib 24 | ARCHIVE DESTINATION lib) 25 | set_target_properties(divsufsort64 PROPERTIES 26 | VERSION "${LIBRARY_VERSION_FULL}" 27 | SOVERSION "${LIBRARY_VERSION_MAJOR}" 28 | DEFINE_SYMBOL DIVSUFSORT_BUILD_DLL 29 | COMPILE_FLAGS "-DBUILD_DIVSUFSORT64" 30 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../examples") 31 | endif(BUILD_DIVSUFSORT64) 32 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/lib/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libdivsufsort 2 | 3 | lib_LTLIBRARIES = libdivsufsort.la 4 | libdivsufsort_la_SOURCES = divsufsort.c sssort.c trsort.c utils.c 5 | libdivsufsort_la_CPPFLAGS = -I$(top_srcdir)/include 6 | libdivsufsort_la_LDFLAGS = -version-info @LT_CURRENT@:@LT_REVISION@:@LT_AGE@ -export-symbols $(srcdir)/libdivsufsort.sym 7 | 8 | if DIVSUFSORT64 9 | lib_LTLIBRARIES += libdivsufsort64.la 10 | libdivsufsort64_la_SOURCES = divsufsort.c sssort.c trsort.c utils.c 11 | libdivsufsort64_la_CPPFLAGS = -I$(top_srcdir)/include -DBUILD_DIVSUFSORT64 12 | libdivsufsort64_la_LDFLAGS = -version-info @LT_CURRENT@:@LT_REVISION@:@LT_AGE@ -export-symbols $(srcdir)/libdivsufsort64.sym 13 | endif 14 | 15 | EXTRA_DIST = libdivsufsort.sym libdivsufsort64.sym CMakeLists.txt 16 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/lib/libdivsufsort.sym: -------------------------------------------------------------------------------- 1 | divsufsort 2 | divbwt 3 | divsufsort_version 4 | bw_transform 5 | inverse_bw_transform 6 | sufcheck 7 | sa_search 8 | sa_simplesearch 9 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/lib/libdivsufsort64.sym: -------------------------------------------------------------------------------- 1 | divsufsort64 2 | divbwt64 3 | divsufsort64_version 4 | bw_transform64 5 | inverse_bw_transform64 6 | sufcheck64 7 | sa_search64 8 | sa_simplesearch64 9 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # Generated from ltversion.in. 11 | 12 | # serial 3017 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.2.6b]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3017]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.2.6b' 20 | macro_revision='1.3017' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/pkgconfig/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## generate libdivsufsort.pc ## 2 | set(prefix "${CMAKE_INSTALL_PREFIX}") 3 | set(W64BIT "") 4 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libdivsufsort.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libdivsufsort.pc" @ONLY) 5 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libdivsufsort.pc" DESTINATION lib/pkgconfig) 6 | if(BUILD_DIVSUFSORT64) 7 | set(W64BIT "64") 8 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libdivsufsort.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libdivsufsort64.pc" @ONLY) 9 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libdivsufsort64.pc" DESTINATION lib/pkgconfig) 10 | endif(BUILD_DIVSUFSORT64) 11 | -------------------------------------------------------------------------------- /libdivsufsort-2.0.1/pkgconfig/libdivsufsort.pc.cmake: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: @PROJECT_NAME@@W64BIT@ 7 | Description: @PROJECT_DESCRIPTION@ 8 | Version: @PROJECT_VERSION_FULL@ 9 | URL: @PROJECT_URL@ 10 | Libs: -L${libdir} -ldivsufsort@W64BIT@ 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /scripts/download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Helper function to download files. It tries 4 | # to use either wget or curl. 5 | # Argument 1: URL of the download file 6 | function download_from_url { 7 | wget_path=`which wget` # returns an empty path if wget is not found 8 | if [[ -z ${wget_path} ]] ; then # if empty path => wget not found 9 | curl_path=`which curl` 10 | if [[ -z ${curl_path} ]] ; then 11 | echo "ERROR: Neither wget nor curl is installed. Can not download required files." 12 | else # curl found => download with curl 13 | curl -O $1 14 | fi 15 | else # wget found => download with wget 16 | wget $1 17 | fi 18 | } 19 | -------------------------------------------------------------------------------- /sdsl_definitions.sty: -------------------------------------------------------------------------------- 1 | \newcommand{\Order}[1]{\mathcal{O}(#1)} % big O-Notation 2 | \newcommand{\order}[1]{\mathcal{o}(#1)} % small o-Notation 3 | 4 | \newcommand{\lcpaccess}[0]{\ensuremath{t_{LCP}}} 5 | \newcommand{\saaccess}[0]{\ensuremath{t_{SA}}} 6 | \newcommand{\isaaccess}[0]{\ensuremath{t_{SA^{-1}}}} 7 | \newcommand{\rrenclose}[0]{\ensuremath{t_{\mathit{rr-enclose}}}} 8 | 9 | \newcommand{\CSA}[0]{\ensuremath{\mathcal{CSA}}} 10 | \newcommand{\CST}[0]{\ensuremath{\mathcal{CST}}} 11 | 12 | \newcommand{\SUF}[0]{\ensuremath{\mathcal{SA}}} 13 | \newcommand{\ISA}[0]{\ensuremath{\mathcal{SA}^{-1}}} 14 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | ./* # ignore every file in the current directory 3 | !*/ # don't ignore subdirectories 4 | !*.cpp # don't ignore .cpp-files 5 | !.gitignore # don't ignore the .gitignore file 6 | !README # don't ignore the README file 7 | -------------------------------------------------------------------------------- /test/BitMagicTest.cpp: -------------------------------------------------------------------------------- 1 | #include "sdsl/int_vector.hpp" 2 | #include "sdsl/bitmagic.hpp" 3 | #include "sdsl/util.hpp" 4 | #include "gtest/gtest.h" 5 | #include 6 | #include // for rand() 7 | #include 8 | 9 | namespace 10 | { 11 | 12 | typedef sdsl::int_vector<>::size_type size_type; 13 | 14 | // The fixture for testing class int_vector. 15 | class BitMagicTest : public ::testing::Test 16 | { 17 | protected: 18 | 19 | BitMagicTest() { 20 | // You can do set-up work for each test here. 21 | } 22 | 23 | virtual ~BitMagicTest() { 24 | // You can do clean-up work that doesn't throw exceptions here. 25 | } 26 | 27 | // If the constructor and destructor are not enough for setting up 28 | // and cleaning up each test, you can define the following methods: 29 | virtual void SetUp() { 30 | // Code here will be called immediately after the constructor (right 31 | // before each test). 32 | } 33 | 34 | virtual void TearDown() { 35 | // Code here will be called immediately after each test (right 36 | // before the destructor). 37 | } 38 | 39 | // Objects declared here can be used by all tests in the test case for Foo. 40 | }; 41 | 42 | //! Test the default constructor 43 | TEST_F(BitMagicTest, Rank) 44 | { 45 | for (size_type i=0; i<64; ++i) { 46 | ASSERT_EQ(sdsl::bit_magic::b1Cnt(1ULL<> j)&1) { 62 | ++ones; 63 | ASSERT_EQ(sdsl::bit_magic::i1BP(x, ones), j); 64 | ASSERT_EQ(sdsl::bit_magic::j1BP(x, ones), j); 65 | ASSERT_EQ(sdsl::bit_magic::k1BP(x, ones), j); 66 | } 67 | } 68 | } 69 | } 70 | 71 | 72 | } // namespace 73 | 74 | int main(int argc, char** argv) 75 | { 76 | ::testing::InitGoogleTest(&argc, argv); 77 | return RUN_ALL_TESTS(); 78 | } 79 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}) 2 | 3 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Makefile.cmake" 4 | "${CMAKE_CURRENT_SOURCE_DIR}/Makefile" @ONLY) 5 | -------------------------------------------------------------------------------- /test/Makefile.cmake: -------------------------------------------------------------------------------- 1 | CC=g++ 2 | CC_FLAGS=-Wall -g -O3 -I@CMAKE_INSTALL_PREFIX@/include -L@CMAKE_INSTALL_PREFIX@/lib -DNDEBUG -funroll-loops 3 | CCLIB=-lsdsl -ldivsufsort -ldivsufsort64 -lgtest 4 | SOURCES=$(wildcard *Test.cpp) 5 | EXECS=$(SOURCES:.cpp=) 6 | EXEC_LIST=$(patsubst %,./%;,$(EXECS)) # list of executables 7 | EXEC_LIST_VAL=$(patsubst %,valgrind ./%;,$(EXECS)) # list of executables preceded by valgrind command 8 | 9 | all: $(EXECS) 10 | 11 | %:%.cpp 12 | $(CC) $(CC_FLAGS) -o $@ $< $(CCLIB) 13 | 14 | clean: 15 | rm -f $(EXECS) 16 | 17 | # TODO special test case for BitMagicTestSSE 18 | 19 | test: 20 | ./test_cases/small/get_corpus.sh 21 | $(EXEC_LIST) 22 | 23 | 24 | vtest: 25 | ./test_cases/small/get_corpus.sh 26 | $(EXEC_LIST_VAL) 27 | -------------------------------------------------------------------------------- /test/README: -------------------------------------------------------------------------------- 1 | This is a set of tests for the succinct data structure library (sdsl). 2 | 3 | You can compile the tests by calling 4 | `make` 5 | and execute them by calling 6 | `make test` 7 | or 8 | `make vtest`, if you would like to 9 | call the test with valgrind. 10 | . 11 | 12 | In some test instances we generate data structures, e.g. 13 | compressed suffix trees, for real world inputs. 14 | These inputs are downloaded with the command 15 | `curl` from a ``Project Gutenberg'' mirror before the 16 | first execution of the test. 17 | 18 | The tests use google's gtest framework which should 19 | be installed, since you have already executed 20 | the `install.sh` bash script to install the sdsl 21 | library. 22 | 23 | If you find a bug, please report it to us. Thanks. 24 | -------------------------------------------------------------------------------- /test/WtIntTest.cpp: -------------------------------------------------------------------------------- 1 | #include "sdsl/wt_int.hpp" 2 | #include "sdsl/util.hpp" 3 | #include "sdsl/rrr_vector.hpp" 4 | #include "sdsl/sd_vector.hpp" 5 | #include "gtest/gtest.h" 6 | #include 7 | #include // for rand() 8 | #include 9 | 10 | namespace 11 | { 12 | 13 | typedef sdsl::int_vector<>::size_type size_type; 14 | 15 | template 16 | class WtIntTest : public ::testing::Test 17 | { 18 | protected: 19 | 20 | WtIntTest() { 21 | // You can do set-up work for each test here. 22 | } 23 | 24 | virtual ~WtIntTest() { 25 | // You can do clean-up work that doesn't throw exceptions here. 26 | } 27 | 28 | // If the constructor and destructor are not enough for setting up 29 | // and cleaning up each test, you can define the following methods: 30 | virtual void SetUp() { 31 | // Code here will be called immediately after the constructor (right 32 | // before each test). 33 | tmp_file = "tmp_wt_int_test_" + sdsl::util::to_string(sdsl::util::get_pid()) + "_"; 34 | } 35 | 36 | virtual void TearDown() { 37 | // Code here will be called immediately after each test (right 38 | // before the destructor). 39 | } 40 | // Objects declared here can be used by all tests in the test case for Foo. 41 | std::string tmp_file; 42 | }; 43 | 44 | using testing::Types; 45 | 46 | typedef Types< 47 | sdsl::wt_int<>, 48 | sdsl::wt_int, sdsl::rrr_vector<15> >, 49 | sdsl::wt_int, sdsl::rrr_vector<63> > 50 | > Implementations; 51 | 52 | TYPED_TEST_CASE(WtIntTest, Implementations); 53 | 54 | // TODO: test streaming operator 55 | 56 | //! Test the parametrized constructor 57 | TYPED_TEST(WtIntTest, Constructor) 58 | { 59 | uint8_t width = 18; 60 | std::string suffix = "constructor"; 61 | sdsl::int_vector<> iv(1000000,0,width); 62 | sdsl::util::set_random_bits(iv, 17); 63 | double iv_size = sdsl::util::get_size_in_mega_bytes(iv); 64 | 65 | sdsl::util::store_to_file(iv, (this->tmp_file+suffix).c_str()); 66 | { 67 | sdsl::int_vector_file_buffer<> buf((this->tmp_file+suffix).c_str()); 68 | TypeParam wt(buf); 69 | std::cout << "compression = " << sdsl::util::get_size_in_mega_bytes(wt)/iv_size << std::endl; 70 | ASSERT_EQ(iv.size(), wt.size()); 71 | for (size_type i=0; i < iv.size(); ++i) { 72 | ASSERT_EQ(iv[i], wt[i])<tmp_file+suffix).c_str()); 76 | } 77 | 78 | } // namespace 79 | 80 | int main(int argc, char** argv) 81 | { 82 | ::testing::InitGoogleTest(&argc, argv); 83 | return RUN_ALL_TESTS(); 84 | } 85 | -------------------------------------------------------------------------------- /test/test_cases/crafted/100a.txt: -------------------------------------------------------------------------------- 1 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -------------------------------------------------------------------------------- /test/test_cases/crafted/README: -------------------------------------------------------------------------------- 1 | This directory contains crafted inputs. Here are details about the inputs: 2 | 3 | 100a.txt Consists of exactly 100 a-characters. 4 | abc_abc_abc.txt Contains 3 0-bytes: At position 3 6 and 9. 5 | abc_abc_abc2.txt Contains 3 255-bytes: At position 3 6 and 9. 6 | -------------------------------------------------------------------------------- /test/test_cases/crafted/abc_abc_abc.txt: -------------------------------------------------------------------------------- 1 | abcabcabc 2 | -------------------------------------------------------------------------------- /test/test_cases/crafted/abc_abc_abc2.txt: -------------------------------------------------------------------------------- 1 | abcabcabc 2 | -------------------------------------------------------------------------------- /test/test_cases/crafted/empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simongog/sdsl/be00712861fa4d3a1acda9fe683894e5c06ade69/test/test_cases/crafted/empty.txt -------------------------------------------------------------------------------- /test/test_cases/crafted/example01.txt: -------------------------------------------------------------------------------- 1 | mississippi 2 | -------------------------------------------------------------------------------- /test/test_cases/small/.gitignore: -------------------------------------------------------------------------------- 1 | *.txt 2 | -------------------------------------------------------------------------------- /test/test_cases/small/README: -------------------------------------------------------------------------------- 1 | This directory contains small test cases which are used to 2 | test complex succinct data structures like 3 | - wavelet trees 4 | - compressed suffix arrays 5 | - compressed suffix trees 6 | 7 | The directory is shipped without content. To download 8 | the test files please call the bash script 9 | 10 | ./get_corpus.sh 11 | 12 | The script downloads the test cases from a mirror 13 | of ``Project Gutenberg'' (http://www.gutenberg.org/). 14 | -------------------------------------------------------------------------------- /test/test_cases/small/get_corpus.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | OLD_DIR=`pwd` 4 | CUR_DIR="$( cd "$( dirname "$0" )" && pwd )" # gets the directory where the script is located in 5 | cd ${CUR_DIR} 6 | 7 | # Download test cases 8 | GUTENBERG_MIRROR="ftp://www.artfiles.org/gutenberg.org" 9 | FAUST_URL="${GUTENBERG_MIRROR}/2/2/2/2229/2229-8.txt" 10 | FAUST_BASENAME=`basename ${FAUST_URL}` 11 | FAUST_NAME='faust.txt' 12 | 13 | ZARATHUSTRA_URL="${GUTENBERG_MIRROR}/7/2/0/7205/7205-8.txt" 14 | ZARATHUSTRA_BASENAME=`basename ${ZARATHUSTRA_URL}` 15 | ZARATHUSTRA_NAME='zarathustra.txt' 16 | 17 | # Include download function 18 | source "${CUR_DIR}/../../../scripts/download.sh" 19 | 20 | if [[ ! -e ${FAUST_NAME} ]]; then 21 | download_from_url "${FAUST_URL}" 22 | mv ${FAUST_BASENAME} ${FAUST_NAME} 23 | fi 24 | 25 | if [[ ! -e ${ZARATHUSTRA_NAME} ]]; then 26 | download_from_url "${ZARATHUSTRA_URL}" 27 | mv ${ZARATHUSTRA_BASENAME} ${ZARATHUSTRA_NAME} 28 | fi 29 | 30 | cd ${OLD_DIR} 31 | --------------------------------------------------------------------------------