├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── HACKING ├── INSTALL ├── Makefile.am ├── Makefile.in ├── Makefile.orig ├── NEWS ├── README ├── README.md ├── aclocal.m4 ├── build-aux ├── config.guess ├── config.h.in ├── config.sub ├── depcomp ├── install-sh ├── ltmain.sh └── missing ├── cds.pc.in ├── config ├── astyle.cfg ├── bcpp.cfg ├── copy_header.py ├── cpplint.py ├── cpplint.pyc ├── cpplint_unittest.py ├── generate_arrays.py ├── indent.py └── run_test.py ├── configure ├── configure.ac ├── dep ├── Makefile ├── build-gtest └── 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 │ ├── 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 ├── gocode ├── Makefile ├── libcds.i └── src │ ├── libcds2 │ └── delete_me │ └── main │ └── test.go ├── include ├── Makefile.am ├── Makefile.in └── libcds2 │ ├── array.h │ ├── cdsexception.h │ ├── dynamic │ └── memorymanager.h │ ├── immutable │ ├── bitsequence.h │ ├── bitsequenceonelevelrank.h │ ├── bitsequenceseq.h │ ├── coder.h │ ├── codernone.h │ ├── mapper.h │ ├── mappernone.h │ ├── permutation.h │ ├── permutationmrrr.h │ ├── sequence.h │ ├── tree.h │ ├── treelouds.h │ ├── wavelettree.h │ └── wavelettreenoptrs.h │ ├── io.h │ ├── libcds.h │ └── time.h ├── lib ├── Makefile.am └── Makefile.in ├── m4 ├── libtool.m4 ├── ltoptions.m4 ├── ltsugar.m4 ├── ltversion.m4 └── lt~obsolete.m4 ├── src ├── basic │ ├── array.cpp │ └── io.cpp └── immutable │ ├── bitsequence.cpp │ ├── bitsequenceonelevelrank.cpp │ ├── bitsequenceseq.cpp │ ├── coder.cpp │ ├── codernone.cpp │ ├── mapper.cpp │ ├── mappernone.cpp │ ├── permutation.cpp │ ├── permutationmrrr.cpp │ ├── sequence.cpp │ ├── tree.cpp │ ├── treelouds.cpp │ ├── wavelettree.cpp │ └── wavelettreenoptrs.cpp ├── tests ├── Makefile.am ├── Makefile.in ├── inputs │ └── input1 ├── run_all.sh ├── test_array.cpp ├── test_basic.cpp ├── test_bitsequence.cpp ├── test_bitsequence_utils.cpp ├── test_bitsequence_utils.h ├── test_bitsequenceonelevelrank.cpp ├── test_codernone.cpp ├── test_ioh.cpp ├── test_libcdsh.cpp ├── test_main.cpp ├── test_mappernone.cpp ├── test_memorymanager.cpp ├── test_permutationmrrr.cpp ├── test_sequence.cpp ├── test_sequence_utils.cpp ├── test_sequence_utils.h ├── test_timeh.cpp └── test_treelouds.cpp └── tutorials └── tutorialSPIRE2012.pdf /.gitignore: -------------------------------------------------------------------------------- 1 | *.dSYM 2 | .*.swp 3 | *~ 4 | *.la 5 | *.lo 6 | *.o 7 | *.core 8 | core 9 | dep/gtest-1.6.0/Makefile 10 | dep/gtest-1.6.0/build-aux/config.h 11 | dep/gtest-1.6.0/build-aux/stamp-h1 12 | dep/gtest-1.6.0/config.log 13 | dep/gtest-1.6.0/config.status 14 | dep/gtest-1.6.0/fused-src/gtest/.deps/ 15 | dep/gtest-1.6.0/lib/ 16 | dep/gtest-1.6.0/libtool 17 | dep/gtest-1.6.0/samples/.deps/ 18 | dep/gtest-1.6.0/samples/.dirstamp 19 | dep/gtest-1.6.0/scripts/gtest-config 20 | dep/gtest-1.6.0/src/.deps/ 21 | dep/gtest-1.6.0/src/.dirstamp 22 | dep/gtest-1.6.0/test/.deps/ 23 | .DS_Store 24 | autom4te.cache 25 | /Makefile 26 | /lib/Makefile 27 | build-aux/config.h 28 | build-aux/stamp-h1 29 | config.log 30 | config.status 31 | libtool 32 | .libs 33 | .deps 34 | .dirstamp 35 | /tests/Makefile 36 | /dep/gtest-1.6.0/samples/sample10_unittest 37 | /dep/gtest-1.6.0/samples/sample1_unittest 38 | /dep/gtest-1.6.0/test/fused_gtest_test 39 | /dep/gtest-1.6.0/test/gtest_all_test 40 | /tests/test_array 41 | /tests/test_bitsequence 42 | /tests/test_bitsequenceonelevelrank 43 | /tests/test_codernone 44 | /tests/test_ioh 45 | /tests/test_libcdsh 46 | /tests/test_mappernone 47 | /tests/test_memorymanager 48 | /tests/test_permutationmrrr 49 | /tests/test_sequence 50 | /tests/test_timeh 51 | /tests/test_treelouds 52 | /include/Makefile 53 | cds*.pc 54 | /dep/gtest-stamp 55 | /dep/gtest-1.6.0/CMakeCache.txt 56 | *.cmake 57 | /dep/gtest-1.6.0/CMakeFiles 58 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fclaude/libcds2/441c126fb06888840761e60087193dbdae646921/AUTHORS -------------------------------------------------------------------------------- /HACKING: -------------------------------------------------------------------------------- 1 | Build tools: 2 | 3 | If you modify the configure.ac or Makefile.am files, rebuild the 4 | autoconf/automake generated files like so: 5 | 6 | autoreconf -vif --no-recursive 7 | 8 | Portability (last fully checked in commit 87434a0): 9 | 10 | Ubuntu 12.04 (x86_64): 11 | no issues. 12 | 13 | OpenBSD 5.4 (i386): 14 | Three test failures: 15 | * [ RUN ] Fields.AllBits 16 | Segmentation fault (core dumped) 17 | FAIL: test_libcdsh 18 | * [ RUN ] BitSequence.SupportingRank0 19 | assertion "users_count_ > 0" failed: file "../include/libcds2/libcds.h", line 342, function "Unuse" 20 | Abort trap (core dumped) 21 | FAIL: test_bitsequence 22 | * [ RUN ] CoderNone.EncodeRandomElements 23 | unknown file: Failure 24 | C++ exception with description "std::bad_alloc" thrown in the test body. 25 | [ FAILED ] CoderNone.EncodeRandomElements (54 ms) 26 | FAIL: test_codernone 27 | 28 | FreeBSD 9.2 (i386): 29 | One test failure: 30 | * [ RUN ] Fields.AllBits 31 | Segmentation fault (core dumped) 32 | FAIL: test_libcdsh 33 | 34 | Solaris 11 (i386): 35 | The same tests fail as in OpenBSD, but also make check ends with 36 | an error which might just be a known-ish autoconf issue: 37 | make: Fatal error: Command failed for target `check-TESTS' 38 | 39 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # This Makefile is the base Makefile of the project and is used to 2 | # build the entire project. 3 | 4 | ACLOCAL_AMFLAGS = -I m4 5 | 6 | SUBDIRS = include lib dep tests 7 | 8 | pkgconfigdir = $(libdir)/pkgconfig 9 | pkgconfig_DATA = cds$(CDS_API_VERSION).pc 10 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fclaude/libcds2/441c126fb06888840761e60087193dbdae646921/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | LIBCDS 2 - A Compressed Data Structure Library 2 | ================================================ 3 | 4 | Rationale 5 | --------- 6 | LIBCDS 2 is the re-coding of [LIBCDS][libcds1] with these goals: 7 | 8 | - 64-Bit support to allow for larger, single structures. 9 | - Speedups 10 | - Improve code readability 11 | - Include unit tests ([googletest][googtest]) 12 | - Improve documentation 13 | 14 | Further long-term goals include: 15 | 16 | - Introduce missing types to the library. 17 | - Provide packages for common GNU/Linux distributions, and other OSs. 18 | - Provide the option of installing it as a shared library (easing compilation and updates). 19 | - Wrappers for popular programming languages. 20 | 21 | 22 | Links 23 | ----- 24 | Some useful project links are below: 25 | 26 | - [LIBCDS 2 GitHub project][gitproject] 27 | - [LIBCDS 2 Wiki][wiki] 28 | - [LIBCDS 2 Issues][issues] 29 | - [Original LIBCDS Site][libcds1] 30 | - [LIBCDS 2 Developers Google Group][devgroup] 31 | 32 | 33 | Guidelines 34 | ---------- 35 | 36 | - If you make changes to autoconf files (configure.ac or Makefile.am files), please rerun autoconf like so: `autoreconf -vif --no-recursive`. 37 | 38 | - When you commit, it is useful to give a good message. 39 | 40 | - The code tries to follow this style guide [C++ Style Guide][cppstyle]. 41 | 42 | - Before commiting, please make sure you run all tests and 'make cpplint/indent' to check for style errors. 43 | 44 | [libcds1]: http://libcds.recoded.cl/ 45 | [devgroup]: http://groups.google.com/group/libcds-dev/ 46 | [googtest]: http://code.google.com/p/googletest/ 47 | [gitproject]: https://github.com/fclaude/libcds2 48 | [cppstyle]: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 49 | [wiki]: https://github.com/fclaude/libcds2/wiki 50 | [issues]: https://github.com/fclaude/libcds2/issues 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | README -------------------------------------------------------------------------------- /cds.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: @PACKAGE_NAME@ 7 | Description: C++ Compact Data Structures Library 8 | Version: @PACKAGE_VERSION@ 9 | URL: @PACKAGE_URL@ 10 | Libs: -L${libdir} -lcds@CDS_API_VERSION@ 11 | Cflags: -I${includedir}/libcds@CDS_API_VERSION@ -I${libdir}/libcds@CDS_API_VERSION@/include 12 | -------------------------------------------------------------------------------- /config/astyle.cfg: -------------------------------------------------------------------------------- 1 | --style=java 2 | --indent=spaces=2 3 | --indent-switches 4 | --indent-classes 5 | --indent-preprocessor 6 | --indent-col1-comments 7 | --pad-oper 8 | --pad-header 9 | --unpad-paren 10 | --add-brackets 11 | --convert-tabs 12 | --align-pointer=name 13 | -------------------------------------------------------------------------------- /config/copy_header.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # copy_header.py 4 | # Copyright (C) 2011 Francisco Claude F. 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | 20 | import os 21 | import sys 22 | import shutil 23 | 24 | if len(sys.argv)!=2: 25 | print "usage: " + sys.argv[0] + "
" 26 | os.exit(0) 27 | 28 | fname = sys.argv[1] 29 | #print "File name: " + fname 30 | path = fname.split("/")[2:-1] 31 | actual_path = "./includes/libcds" 32 | for dir in path: 33 | if dir=="basic": continue 34 | actual_path += "/"+dir 35 | if not os.access(actual_path,os.F_OK): 36 | #print "mkdir " + actual_path 37 | os.mkdir(actual_path) 38 | #print "cp "+fname+" "+actual_path 39 | shutil.copy(fname,actual_path) 40 | 41 | -------------------------------------------------------------------------------- /config/cpplint.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fclaude/libcds2/441c126fb06888840761e60087193dbdae646921/config/cpplint.pyc -------------------------------------------------------------------------------- /config/generate_arrays.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | for i in range(64): 4 | print "\t\tcase %d: return new ArrayTpl<%d>(n);" % (i, i) 5 | 6 | for i in range(58): 7 | print "TEST(Array,Timing%d) {\n\ttestForSpeed(%d);\n}" % (i, i) 8 | 9 | for i in range(58): 10 | print "\t\tcase %d: return ArrayTpl<%d>::Load(input);" % (i, i) 11 | 12 | -------------------------------------------------------------------------------- /config/indent.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # copy_header.py 4 | # Copyright (C) 2011 Francisco Claude F. 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | 20 | import os 21 | import sys 22 | 23 | if len(sys.argv)!=2: 24 | print("Usage: %s " % sys.argv[0]) 25 | sys.exit(0) 26 | 27 | os.system("astyle --options=./config/astyle.cfg %s\n" % (sys.argv[1])) 28 | -------------------------------------------------------------------------------- /config/run_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | from optparse import OptionParser 4 | import os 5 | import smtplib 6 | from email.mime.text import MIMEText 7 | 8 | 9 | def run_test(name, binary): 10 | global str_summary 11 | global str_output 12 | print "Running test: " + name + " (" + binary + ")" 13 | status = os.system(binary + " --gtest_color=no > test_out.log") 14 | if status == 0: st = "PASSED" 15 | else: st = "FAILED" 16 | str_summary += "\n" + name + " status : " + st 17 | str_output += "\n\n----------" + name + "----------\n" 18 | fp = open("./test_out.log", "r") 19 | str_output += fp.read() 20 | fp.close() 21 | os.system("rm -f ./test_out.log") 22 | print "Done running test " + name 23 | 24 | def mail_results(): 25 | msg = """From: Libcds2 Team 26 | To: %s 27 | Subject: libcds2 test results 28 | 29 | %s 30 | 31 | %s""" % (options.address, str_summary, str_output) 32 | s = smtplib.SMTP(options.server) 33 | s.ehlo() 34 | s.sendmail("libcds@recoded.cl", options.address, msg) 35 | s.quit() 36 | 37 | if __name__ == "__main__": 38 | str_summary = "" 39 | str_output = "" 40 | parser = OptionParser() 41 | parser.add_option("-a", "--mail-address", dest="address", help="Mail address to send reports") 42 | parser.add_option("-s", "--mail-server", dest="server", help="Mail server to send reports") 43 | parser.add_option("-t", "--test", dest="test", help="Test binary") 44 | (options, args) = parser.parse_args() 45 | for test in options.test.split(","): 46 | run_test(test, test) 47 | mail_results() 48 | 49 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # -*- Autoconf -*- 2 | # To rebuild the configure script and Makefile.in files (as well as some 3 | # supporting files mainly in build-aux/ and m4/) run the following 4 | # command: 5 | # autoreconf -vif --no-recursive 6 | # The last flag is there to prevent autoconf from trying to rebuild 7 | # the autoconf files in dep/gflags-1.6.0. 8 | 9 | AC_PREREQ([2.68]) 10 | AC_INIT([libcds2], [2.0], [fclaude@gmail.com], [cds2], 11 | [https://github.com/fclaude/libcds2]) 12 | AC_CONFIG_SRCDIR([src/basic/array.cpp]) 13 | AC_CONFIG_MACRO_DIR([m4]) 14 | AC_CONFIG_AUX_DIR([build-aux]) 15 | AC_CONFIG_HEADERS([build-aux/config.h]) 16 | AM_INIT_AUTOMAKE([1.11 subdir-objects]) 17 | AM_SILENT_RULES([yes]) 18 | LT_INIT([shared static]) 19 | AC_SUBST([LIBTOOL_DEPS]) 20 | AC_SUBST([CDS_SO_VERSION], [2:0:0]) 21 | AC_SUBST([CDS_API_VERSION], [2]) 22 | 23 | # Checks for programs. 24 | # If we want to explicitly set this to a different optimization level, this 25 | # is where we do it. But do note this is not conventionally approved of. 26 | # ${CXXFLAGS="-O3"} 27 | AC_PROG_CXX 28 | AC_LANG([C++]) 29 | AC_PROG_INSTALL 30 | AC_PROG_CPP 31 | 32 | # Checks for libraries. 33 | 34 | # Checks for header files. 35 | AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h sys/time.h]) 36 | 37 | # Checks for typedefs, structures, and compiler characteristics. 38 | AC_HEADER_STDBOOL 39 | AC_C_INLINE 40 | AC_TYPE_SIZE_T 41 | AC_TYPE_UINT16_T 42 | AC_TYPE_UINT32_T 43 | AC_TYPE_UINT8_T 44 | 45 | # Checks for library functions. 46 | AC_CHECK_FUNCS([gettimeofday select]) 47 | 48 | AC_CONFIG_FILES([Makefile 49 | lib/Makefile 50 | tests/Makefile 51 | include/Makefile 52 | cds${CDS_API_VERSION}.pc:cds.pc.in]) 53 | AC_CONFIG_SUBDIRS([dep/gtest-1.6.0]) 54 | AC_OUTPUT 55 | -------------------------------------------------------------------------------- /dep/Makefile: -------------------------------------------------------------------------------- 1 | GTEST_DIR = gtest-1.6.0 2 | 3 | .PHONY: all 4 | all: 5 | 6 | # All targets that might lead to make check. 7 | .PHONY: check 8 | check: gtest-stamp 9 | 10 | .PHONY: installcheck 11 | installcheck: gtest-stamp 12 | 13 | gtest-stamp: 14 | @$(SHELL) build-gtest 15 | 16 | # Support "clean" targets for automake and cmake Makefiles... 17 | .PHONY: mostlyclean 18 | mostlyclean: 19 | @cd $(GTEST_DIR) && $(MAKE) mostlyclean || $(MAKE) clean 20 | @rm gtest-stamp 21 | 22 | .PHONY: clean 23 | clean: 24 | @cd $(GTEST_DIR) && $(MAKE) clean 25 | @rm -f gtest-stamp 26 | 27 | .PHONY: distclean 28 | distclean: 29 | @cd $(GTEST_DIR) && $(MAKE) distclean || $(MAKE) clean 30 | @rm -f gtest-stamp 31 | 32 | .PHONY: maintainer-clean 33 | maintainer-clean: 34 | @cd $(GTEST_DIR) && $(MAKE) maintainer-clean || $(MAKE) clean 35 | @rm -f gtest-stamp 36 | 37 | 38 | EMPTY_AUTOMAKE_TARGETS = dvi pdf ps info html tags ctags distdir install install-data install-exec uninstall install-dvi install-html install-info install-ps install-pdf installdirs 39 | .PHONY: $(EMPTY_AUTOMAKE_TARGETS) 40 | $(EMPTY_AUTOMAKE_TARGETS): 41 | -------------------------------------------------------------------------------- /dep/build-gtest: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This should be an incredibly simple script. See the autoconf docs on 3 | # writing portable shell scripts. 4 | 5 | # FIXME: 6 | # Ideal strategy to build gtest: 7 | # Try to build gtest with cmake. If that fails, try the configure 8 | # script. If that fails, give up. 9 | # Problem with ideal strategy: 10 | # cmake does not build lib/libgtest.la; it builds libgtest.a. 11 | # So would need to invoke libtool on it. Or something. 12 | 13 | cd gtest-1.6.0 || exit 1 14 | # Ideal, not working way. 15 | #if cmake .; then 16 | # make || exit 1 17 | # mkdir lib 18 | # cp libgtest.a lib/libgtest.la 19 | #else 20 | # ./configure || exit 1 21 | # make || exit 1 22 | #fi 23 | 24 | # Pragmatic way. 25 | ./configure || exit 1 26 | make || exit 1 27 | 28 | touch ../gtest-stamp 29 | -------------------------------------------------------------------------------- /dep/gtest-1.6.0/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/gtest-1.6.0/test/gtest_break_on_failure_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 | // Unit test for Google Test's break-on-failure mode. 33 | // 34 | // A user can ask Google Test to seg-fault when an assertion fails, using 35 | // either the GTEST_BREAK_ON_FAILURE environment variable or the 36 | // --gtest_break_on_failure flag. This file is used for testing such 37 | // functionality. 38 | // 39 | // This program will be invoked from a Python unit test. It is 40 | // expected to fail. Don't run it directly. 41 | 42 | #include "gtest/gtest.h" 43 | 44 | #if GTEST_OS_WINDOWS 45 | # include 46 | # include 47 | #endif 48 | 49 | namespace { 50 | 51 | // A test that's expected to fail. 52 | TEST(Foo, Bar) { 53 | EXPECT_EQ(2, 3); 54 | } 55 | 56 | #if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE 57 | // On Windows Mobile global exception handlers are not supported. 58 | LONG WINAPI ExitWithExceptionCode( 59 | struct _EXCEPTION_POINTERS* exception_pointers) { 60 | exit(exception_pointers->ExceptionRecord->ExceptionCode); 61 | } 62 | #endif 63 | 64 | } // namespace 65 | 66 | int main(int argc, char **argv) { 67 | #if GTEST_OS_WINDOWS 68 | // Suppresses display of the Windows error dialog upon encountering 69 | // a general protection fault (segment violation). 70 | SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS); 71 | 72 | # if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE 73 | 74 | // The default unhandled exception filter does not always exit 75 | // with the exception code as exit code - for example it exits with 76 | // 0 for EXCEPTION_ACCESS_VIOLATION and 1 for EXCEPTION_BREAKPOINT 77 | // if the application is compiled in debug mode. Thus we use our own 78 | // filter which always exits with the exception code for unhandled 79 | // exceptions. 80 | SetUnhandledExceptionFilter(ExitWithExceptionCode); 81 | 82 | # endif 83 | #endif 84 | 85 | testing::InitGoogleTest(&argc, argv); 86 | 87 | return RUN_ALL_TESTS(); 88 | } 89 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /dep/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 | -------------------------------------------------------------------------------- /gocode/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | GOPATH=`pwd` go install main 3 | 4 | clean: 5 | rm -rf pkg/ bin/ 6 | 7 | -------------------------------------------------------------------------------- /gocode/libcds.i: -------------------------------------------------------------------------------- 1 | %module libcds2 2 | %{ 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | using namespace std; 13 | %} 14 | %include "includes/libcds/libcds.h" 15 | %include "includes/libcds/immutable/bitsequence.h" 16 | %include "includes/libcds/immutable/bitsequenceonelevelrank.h" 17 | %include "includes/libcds/array.h" 18 | %include "includes/libcds/immutable/mapper.h" 19 | %include "includes/libcds/immutable/mappernone.h" 20 | %include "includes/libcds/immutable/coder.h" 21 | %include "includes/libcds/immutable/codernone.h" 22 | 23 | -------------------------------------------------------------------------------- /gocode/src/libcds2/delete_me: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fclaude/libcds2/441c126fb06888840761e60087193dbdae646921/gocode/src/libcds2/delete_me -------------------------------------------------------------------------------- /gocode/src/main/test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | import "libcds2" 5 | 6 | func check(b libcds2.BitSequenceOneLevelRank, a libcds2.Array, i, j int, done chan bool) { 7 | for k := i ; k < j; k++ { 8 | if b.Access(i) != (a.GetField(i) > 0) { 9 | fmt.Println("Error, values do not match (", b.Access(i), ", ", a.GetField(i), ")") 10 | } 11 | } 12 | done <- true 13 | } 14 | 15 | func main() { 16 | // libcds2.PrintBinary(35) 17 | N := 10000000 18 | // K := 500000 19 | a := libcds2.ArrayCreate(N, libcds2.Msb(N+1)) 20 | for j := 0; j < N; j++ { 21 | a.SetField(j, j+1) 22 | } 23 | for j := 0; j < N; j++ { 24 | if int(a.GetField(j)) != j+1 { 25 | fmt.Println("Error, values do not match") 26 | } 27 | } 28 | fmt.Println("Size for a: ", a.GetSize()) 29 | 30 | // a2 := libcds2.ArrayCreate(N, 1) 31 | // for i := 0 ; i < N; i++ { 32 | // if i%2 == 1 { 33 | // a2.SetField(i, 1) 34 | // } 35 | // } 36 | // fmt.Println("Bitmap of length ", N, " requires ", a2.GetSize(), " bytes") 37 | // b := libcds2.NewBitSequenceOneLevelRank(a2, 20) 38 | // d := make(chan bool) 39 | // for i := 0; i < N/K; i++ { 40 | // go check(b, a2, i*K, (1+i)*K-1, d) 41 | // } 42 | // for i := 0; i < N/K; i++ { 43 | // var done bool 44 | // select { 45 | // case done = <- d: fmt.Println(done) 46 | // } 47 | // } 48 | fmt.Println("We are done!") 49 | } 50 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | # This Makefile is used to install headers into $(includedir). 2 | # See: http://www.gnu.org/software/automake/manual/automake.html#Headers 3 | 4 | nobase_include_HEADERS = \ 5 | libcds@CDS_API_VERSION@/array.h \ 6 | libcds@CDS_API_VERSION@/cdsexception.h \ 7 | libcds@CDS_API_VERSION@/dynamic/memorymanager.h \ 8 | libcds@CDS_API_VERSION@/immutable/bitsequence.h \ 9 | libcds@CDS_API_VERSION@/immutable/bitsequenceonelevelrank.h \ 10 | libcds@CDS_API_VERSION@/immutable/bitsequenceseq.h \ 11 | libcds@CDS_API_VERSION@/immutable/coder.h \ 12 | libcds@CDS_API_VERSION@/immutable/codernone.h \ 13 | libcds@CDS_API_VERSION@/immutable/mapper.h \ 14 | libcds@CDS_API_VERSION@/immutable/mappernone.h \ 15 | libcds@CDS_API_VERSION@/immutable/permutation.h \ 16 | libcds@CDS_API_VERSION@/immutable/permutationmrrr.h \ 17 | libcds@CDS_API_VERSION@/immutable/sequence.h \ 18 | libcds@CDS_API_VERSION@/immutable/tree.h \ 19 | libcds@CDS_API_VERSION@/immutable/treelouds.h \ 20 | libcds@CDS_API_VERSION@/immutable/wavelettree.h \ 21 | libcds@CDS_API_VERSION@/immutable/wavelettreenoptrs.h \ 22 | libcds@CDS_API_VERSION@/io.h \ 23 | libcds@CDS_API_VERSION@/libcds.h \ 24 | libcds@CDS_API_VERSION@/time.h 25 | -------------------------------------------------------------------------------- /include/libcds2/cdsexception.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | 33 | #ifndef SRC_BASIC_CDSEXCEPTION_H_ 34 | #define SRC_BASIC_CDSEXCEPTION_H_ 35 | 36 | #include 37 | 38 | #include 39 | 40 | namespace cds { 41 | namespace basic { 42 | 43 | using std::string; 44 | 45 | class CDSException { 46 | public: 47 | explicit CDSException(const string &s) { 48 | msg = s; 49 | } 50 | 51 | string what() { 52 | return msg; 53 | } 54 | 55 | protected: 56 | string msg; 57 | }; 58 | }; 59 | }; 60 | 61 | #endif // SRC_BASIC_CDSEXCEPTION_H_ 62 | -------------------------------------------------------------------------------- /include/libcds2/immutable/bitsequenceseq.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | 33 | #ifndef SRC_IMMUTABLE_BITSEQUENCESEQ_H_ 34 | #define SRC_IMMUTABLE_BITSEQUENCESEQ_H_ 35 | 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | 43 | #include 44 | 45 | namespace cds { 46 | namespace immutable { 47 | 48 | using cds::basic::cds_word; 49 | using cds::basic::Array; 50 | using std::istream; 51 | using std::ostream; 52 | 53 | /** Base class for static bitsequences, contains many abstract functions, 54 | * so this can't be instantiated. It includes base implementations for 55 | * rank0, select0 and select1 based on rank0. 56 | * 57 | * @author Francisco Claude 58 | */ 59 | class BitSequenceSeq : public BitSequence { 60 | public: 61 | explicit BitSequenceSeq(Array *array); 62 | virtual ~BitSequenceSeq(); 63 | virtual cds_word Rank0(const cds_word i) const; 64 | virtual cds_word Rank0(const cds_word i, bool *access) const; 65 | virtual cds_word Select0(const cds_word i) const; 66 | virtual cds_word Rank1(const cds_word i) const; 67 | virtual cds_word Rank1(const cds_word i, bool *access) const; 68 | virtual cds_word Select1(const cds_word i) const; 69 | virtual cds_word SelectNext1(const cds_word i) const; 70 | virtual cds_word SelectNext0(const cds_word i) const; 71 | virtual cds_word SelectPrev1(const cds_word i) const; 72 | virtual cds_word SelectPrev0(const cds_word i) const; 73 | virtual bool Access(const cds_word i) const; 74 | virtual cds_word GetLength() const; 75 | virtual cds_word CountOnes() const; 76 | virtual cds_word CountZeros() const; 77 | virtual cds_word GetSize() const; 78 | virtual void Save(ostream &fp) const; 79 | static BitSequence *Load(istream &fp); 80 | 81 | protected: 82 | Array *array_; 83 | }; 84 | }; 85 | }; 86 | 87 | #endif // SRC_IMMUTABLE_BITSEQUENCESEQ_H_ 88 | -------------------------------------------------------------------------------- /include/libcds2/immutable/coder.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude,Roberto Konow 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #ifndef SRC_IMMUTABLE_CODER_H_ 33 | #define SRC_IMMUTABLE_CODER_H_ 34 | 35 | #include 36 | 37 | namespace cds { 38 | namespace immutable { 39 | 40 | #define CODER_NONE_HDR 4 41 | 42 | using cds::basic::cds_word; 43 | using std::ostream; 44 | using std::istream; 45 | 46 | class Coder : public cds::basic::ReferenceCounted { 47 | public: 48 | Coder(); 49 | virtual ~Coder() { } 50 | virtual void Encode(cds_word symb, cds_word *stream, cds_word *pos) const = 0; 51 | virtual cds_word Decode(cds_word *stream, cds_word *pos) const = 0; 52 | virtual cds_word MaxLength() const = 0; 53 | virtual cds_word GetSize() const = 0; 54 | virtual void Save(ostream &output) const = 0; 55 | static Coder *Load(istream &input); 56 | }; 57 | }; 58 | }; 59 | #endif // SRC_IMMUTABLE_CODER_H_ 60 | -------------------------------------------------------------------------------- /include/libcds2/immutable/codernone.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude,Roberto Konow 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #ifndef SRC_IMMUTABLE_CODERNONE_H_ 33 | #define SRC_IMMUTABLE_CODERNONE_H_ 34 | 35 | #include 36 | 37 | namespace cds { 38 | namespace immutable { 39 | 40 | using cds::basic::cds_word; 41 | using std::ostream; 42 | using std::istream; 43 | 44 | 45 | 46 | class CoderNone : public Coder { 47 | public: 48 | CoderNone(); 49 | virtual ~CoderNone() { } 50 | virtual void Encode(cds_word symb, cds_word *stream, cds_word *pos) const; 51 | virtual cds_word Decode(cds_word *stream, cds_word *pos) const; 52 | virtual cds_word MaxLength() const; 53 | virtual cds_word GetSize() const; 54 | virtual void Save(ostream &output) const; 55 | static CoderNone *Load(istream &input); 56 | }; 57 | }; 58 | }; 59 | 60 | #endif // SRC_IMMUTABLE_CODERNONE_H_ 61 | -------------------------------------------------------------------------------- /include/libcds2/immutable/mapper.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude,Roberto Konow 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #ifndef SRC_IMMUTABLE_MAPPER_H_ 33 | #define SRC_IMMUTABLE_MAPPER_H_ 34 | 35 | #include 36 | #include 37 | 38 | namespace cds { 39 | namespace immutable { 40 | 41 | using cds::basic::cds_word; 42 | using std::ostream; 43 | using std::istream; 44 | 45 | #define MAPPER_NONE_HDR 2 46 | #define MAPPER_CONT_HDR 3 47 | 48 | class Mapper : public cds::basic::ReferenceCounted { 49 | public: 50 | Mapper(); 51 | virtual ~Mapper() {} 52 | /** Maps the symbol */ 53 | virtual cds_word Map(cds_word s) const = 0; 54 | /** Unmaps the symbol */ 55 | virtual cds_word Unmap(cds_word s) const = 0; 56 | /** Returns the size of the mapper */ 57 | virtual cds_word GetSize() const = 0; 58 | /** Saves the mapper to a file */ 59 | virtual void Save(ostream &out) const = 0; 60 | /** Loads the mapper from a file */ 61 | static Mapper *Load(istream &input); 62 | }; 63 | }; 64 | }; 65 | 66 | #include 67 | 68 | #endif // SRC_IMMUTABLE_MAPPER_H_ 69 | -------------------------------------------------------------------------------- /include/libcds2/immutable/mappernone.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude,Roberto Konow 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #ifndef SRC_IMMUTABLE_MAPPERNONE_H_ 33 | #define SRC_IMMUTABLE_MAPPERNONE_H_ 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | namespace cds { 40 | namespace immutable { 41 | 42 | using std::ostream; 43 | using std::istream; 44 | 45 | /** Mapper that doesn't change the value (identity) 46 | * 47 | * @author Francisco Claude 48 | */ 49 | class MapperNone : public Mapper { 50 | public: 51 | MapperNone(); 52 | virtual ~MapperNone() {} 53 | virtual cds_word Map(cds_word s) const; 54 | virtual cds_word Unmap(cds_word s) const; 55 | virtual cds_word GetSize() const; 56 | virtual void Save(ostream &out) const; 57 | static MapperNone *Load(istream &input); 58 | }; 59 | }; 60 | }; 61 | 62 | #endif // SRC_IMMUTABLE_MAPPERNONE_H_ 63 | -------------------------------------------------------------------------------- /include/libcds2/immutable/permutation.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | 33 | #ifndef SRC_IMMUTABLE_PERMUTATION_H_ 34 | #define SRC_IMMUTABLE_PERMUTATION_H_ 35 | 36 | 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | namespace cds { 43 | namespace immutable { 44 | 45 | using cds::basic::cds_word; 46 | using std::istream; 47 | using std::ostream; 48 | 49 | const cds_word kPermutationMRRRHdr = 2; 50 | 51 | /** Base class for static permutations, contains many abstract functions, 52 | * so this can't be instantiated. 53 | * 54 | * @author Francisco Claude 55 | */ 56 | class Permutation : public cds::basic::ReferenceCounted { 57 | public: 58 | virtual ~Permutation() {} 59 | 60 | /** Retrieves the element at position i. */ 61 | virtual cds_word Access(cds_word i) const = 0; 62 | 63 | /** Retrieves the inverse for position i. */ 64 | virtual cds_word Reverse(cds_word i) const = 0; 65 | 66 | /** Returns the length of the permutation */ 67 | virtual cds_word GetLength() const = 0; 68 | 69 | /** Returns the size of the structure in bytes */ 70 | virtual cds_word GetSize() const = 0; 71 | 72 | /** Stores the sequence given an output stream. */ 73 | virtual void Save(ostream &fp) const = 0; 74 | 75 | /** Reads a sequence determining the type. */ 76 | static Permutation *Load(istream &fp); 77 | }; 78 | }; 79 | }; 80 | 81 | #include 82 | 83 | #endif // SRC_IMMUTABLE_PERMUTATION_H_ 84 | -------------------------------------------------------------------------------- /include/libcds2/immutable/permutationmrrr.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | 33 | #ifndef SRC_IMMUTABLE_PERMUTATIONMRRR_H_ 34 | #define SRC_IMMUTABLE_PERMUTATIONMRRR_H_ 35 | 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #include 43 | 44 | namespace cds { 45 | namespace immutable { 46 | 47 | using cds::basic::cds_word; 48 | using cds::basic::Array; 49 | using std::istream; 50 | using std::ostream; 51 | 52 | /** Permutations based on Munro, Raman, Raman and Rao's proposal. 53 | * 54 | * @author Francisco Claude 55 | */ 56 | class PermutationMRRR : public Permutation { 57 | public: 58 | PermutationMRRR(Array *perm, cds_word samp); 59 | virtual ~PermutationMRRR(); 60 | virtual cds_word Access(cds_word i) const; 61 | virtual cds_word Reverse(cds_word i) const; 62 | virtual void Save(ostream &fp) const; 63 | virtual cds_word GetLength() const; 64 | virtual cds_word GetSize() const; 65 | 66 | /** Reads a sequence determining the type. */ 67 | static PermutationMRRR *Load(istream &fp); 68 | protected: 69 | Array *permutation_; 70 | Array *rev_links_; 71 | BitSequence *sampled_; 72 | }; 73 | }; 74 | }; 75 | 76 | #endif // SRC_IMMUTABLE_PERMUTATIONMRRR_H_ 77 | -------------------------------------------------------------------------------- /include/libcds2/immutable/tree.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | 33 | #ifndef SRC_IMMUTABLE_TREE_H_ 34 | #define SRC_IMMUTABLE_TREE_H_ 35 | 36 | 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | namespace cds { 43 | namespace immutable { 44 | 45 | using cds::basic::cds_word; 46 | using std::istream; 47 | using std::ostream; 48 | 49 | const cds_word kTreeLoudsHdr = 2; 50 | 51 | /** Base class for static trees, contains many abstract functions, 52 | * so this can't be instantiated. 53 | * 54 | * @author Francisco Claude 55 | */ 56 | class Tree : public cds::basic::ReferenceCounted { 57 | public: 58 | virtual ~Tree() {} 59 | 60 | /** Retrieves the j-th child of node id i. */ 61 | virtual cds_word Child(cds_word i, cds_word j) const = 0; 62 | 63 | /** Retrieves the id of i's parent. */ 64 | virtual cds_word Parent(cds_word i) const = 0; 65 | 66 | /** Computes the degree of a node */ 67 | virtual cds_word Degree(cds_word i) const = 0; 68 | 69 | /** Retrieves the id of the next sibling (or (cds_word)-1 if such node does not exist */ 70 | virtual cds_word NextSibling(cds_word i) const = 0; 71 | 72 | /** Retrieves the id of the previous sibling (or (cds_word)-1 if such node does not exist */ 73 | virtual cds_word PrevSibling(cds_word i) const = 0; 74 | 75 | /** Returns the number of nodes */ 76 | virtual cds_word GetNodes() const = 0; 77 | 78 | /** Returns the size of the structure in bytes */ 79 | virtual cds_word GetSize() const = 0; 80 | 81 | /** Stores the sequence given an output stream. */ 82 | virtual void Save(ostream &fp) const = 0; 83 | 84 | /** Reads a sequence determining the type. */ 85 | static Tree *Load(istream &fp); 86 | }; 87 | }; 88 | }; 89 | 90 | #include 91 | 92 | #endif // SRC_IMMUTABLE_TREE_H_ 93 | -------------------------------------------------------------------------------- /include/libcds2/immutable/treelouds.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | 33 | #ifndef SRC_IMMUTABLE_TREELOUDS_H_ 34 | #define SRC_IMMUTABLE_TREELOUDS_H_ 35 | 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #include 43 | 44 | namespace cds { 45 | namespace immutable { 46 | 47 | using cds::basic::cds_word; 48 | using std::istream; 49 | using std::ostream; 50 | 51 | /** LOUDS implementation. 52 | * 53 | * @author Francisco Claude 54 | */ 55 | class TreeLouds : public Tree { 56 | public: 57 | TreeLouds(BitSequence *bitmap); 58 | virtual ~TreeLouds(); 59 | virtual cds_word Child(cds_word i, cds_word j) const; 60 | virtual cds_word Parent(cds_word i) const; 61 | virtual cds_word Degree(cds_word i) const; 62 | virtual cds_word NextSibling(cds_word i) const; 63 | virtual cds_word PrevSibling(cds_word i) const; 64 | virtual cds_word GetNodes() const; 65 | virtual cds_word GetSize() const; 66 | virtual void Save(ostream &fp) const; 67 | static TreeLouds *Load(istream &fp); 68 | protected: 69 | TreeLouds() {} 70 | BitSequence *bitmap_; 71 | }; 72 | }; 73 | }; 74 | 75 | #endif // SRC_IMMUTABLE_TREELOUDS_H_ 76 | -------------------------------------------------------------------------------- /include/libcds2/immutable/wavelettreenoptrs.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #ifndef SRC_IMMUTABLE_WAVELETTREENOPTRS_H_ 33 | #define SRC_IMMUTABLE_WAVELETTREENOPTRS_H_ 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | #include 42 | 43 | namespace cds { 44 | namespace immutable { 45 | 46 | using std::ostream; 47 | using std::istream; 48 | 49 | class WaveletTreeNoPtrs : public Sequence { 50 | public: 51 | WaveletTreeNoPtrs(const cds::basic::Array *a, BitSequenceBuilder *bmb, Mapper *am); 52 | virtual ~WaveletTreeNoPtrs(); 53 | virtual cds_word Access(cds_word pos) const; 54 | // virtual cds_word Access(cds_word pos, cds_word *rank) const; 55 | virtual cds_word Rank(cds_word symbol, cds_word pos) const; 56 | virtual cds_word Select(cds_word symbol, cds_word j) const; 57 | virtual cds_word Count(cds_word symbol) const; 58 | virtual cds_word GetSigma() const; 59 | virtual cds_word GetLength() const; 60 | virtual cds_word GetSize() const; 61 | virtual void Save(ostream &fp) const; 62 | static WaveletTreeNoPtrs *Load(istream &fp); 63 | 64 | protected: 65 | 66 | WaveletTreeNoPtrs() {} 67 | BitSequence **level_; 68 | cds_word height_; 69 | Mapper *am_; 70 | cds_word n_; 71 | cds_word max_v_; 72 | Array *occ_; 73 | 74 | void BuildLevels(Array *new_array, Array **bitmaps, cds_word ini, cds_word fin, cds_word level); 75 | }; 76 | }; 77 | }; 78 | 79 | #endif // SRC_IMMUTABLE_WAVELETTREENOPTRS_H_ 80 | -------------------------------------------------------------------------------- /include/libcds2/time.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude and Rodrigo Canovas. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | 33 | #ifndef SRC_BASIC_TIME_H_ 34 | #define SRC_BASIC_TIME_H_ 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | namespace cds { 41 | namespace basic { 42 | 43 | /** Timer class. 44 | */ 45 | class Timer { 46 | public: 47 | /** Creates and starts the timer. 48 | */ 49 | Timer() { 50 | Restart(); 51 | } 52 | 53 | /** Restarts the timer. 54 | */ 55 | void Restart() { 56 | getrusage(RUSAGE_SELF, &ru); 57 | initial_ru = ru.ru_utime; 58 | gettimeofday(&initial, NULL); 59 | } 60 | 61 | /** Stops the timer. 62 | */ 63 | void Stop() { 64 | getrusage(RUSAGE_SELF, &ru); 65 | final_ru = ru.ru_utime; 66 | gettimeofday(&final, NULL); 67 | } 68 | 69 | /** Computes the number of microsecond elapsed from start to stop 70 | * This time is for wall-clock time 71 | */ 72 | double ElapsedTime() { 73 | return (final.tv_sec - initial.tv_sec) * 1000000 + (final.tv_usec - initial.tv_usec); 74 | } 75 | 76 | /** Computes the number of microsecond elapsed from start to stop 77 | * This time is for process CPU usage 78 | */ 79 | double ElapsedTimeCPU() { 80 | return (final_ru.tv_sec - initial_ru.tv_sec) * 1000000 + (final_ru.tv_usec - initial_ru.tv_usec); 81 | } 82 | 83 | protected: 84 | struct timeval initial, final; 85 | struct timeval initial_ru, final_ru; 86 | struct rusage ru; 87 | }; 88 | }; 89 | }; 90 | 91 | #endif // SRC_BASIC_TIME_H_ 92 | -------------------------------------------------------------------------------- /lib/Makefile.am: -------------------------------------------------------------------------------- 1 | # This Makefile builds the libcds library. 2 | 3 | AM_CPPFLAGS = -I../include/ 4 | 5 | lib_LTLIBRARIES = libcds@CDS_API_VERSION@.la 6 | libcds@CDS_API_VERSION@_la_LDFLAGS = -version-info $(CDS_SO_VERSION) 7 | libcds@CDS_API_VERSION@_la_SOURCES = \ 8 | ../src/basic/array.cpp \ 9 | ../src/basic/io.cpp \ 10 | ../src/immutable/bitsequence.cpp \ 11 | ../src/immutable/bitsequenceseq.cpp \ 12 | ../src/immutable/bitsequenceonelevelrank.cpp \ 13 | ../src/immutable/sequence.cpp \ 14 | ../src/immutable/mapper.cpp \ 15 | ../src/immutable/mappernone.cpp \ 16 | ../src/immutable/coder.cpp \ 17 | ../src/immutable/codernone.cpp \ 18 | ../src/immutable/permutation.cpp \ 19 | ../src/immutable/permutationmrrr.cpp \ 20 | ../src/immutable/treelouds.cpp \ 21 | ../src/immutable/wavelettreenoptrs.cpp \ 22 | ../src/immutable/tree.cpp 23 | -------------------------------------------------------------------------------- /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 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /src/basic/io.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | namespace cds { 39 | namespace basic { 40 | 41 | using std::string; 42 | using std::vector; 43 | 44 | vector Tokenize(const string &str, const char delim) { 45 | vector tokens; 46 | string::size_type last_pos = 0; 47 | string::size_type pos = str.find_first_of(delim); 48 | while (pos != string::npos) { 49 | if (last_pos < pos) { 50 | tokens.push_back(str.substr(last_pos, pos - last_pos)); 51 | } 52 | last_pos = pos + 1; 53 | if (last_pos >= str.length()) { 54 | break; 55 | } 56 | pos = str.find_first_of(delim, pos + 1); 57 | } 58 | if (last_pos < str.length()) { 59 | tokens.push_back(str.substr(last_pos)); 60 | } 61 | return tokens; 62 | } 63 | }; 64 | }; 65 | -------------------------------------------------------------------------------- /src/immutable/coder.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude,Roberto Konow 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | #include 32 | #include 33 | #include 34 | 35 | using cds::basic::cds_word; 36 | using std::ostream; 37 | using std::istream; 38 | 39 | namespace cds { 40 | namespace immutable { 41 | 42 | Coder::Coder() { } 43 | 44 | Coder *Coder::Load(istream &input) { 45 | cds_word rd = cds::basic::LoadValue(input); 46 | cds_word pos = input.tellg(); 47 | input.seekg(pos - sizeof(cds_word)); 48 | switch (rd) { 49 | case CODER_NONE_HDR: 50 | return CoderNone::Load(input); 51 | } 52 | return NULL; 53 | } 54 | }; 55 | }; 56 | -------------------------------------------------------------------------------- /src/immutable/codernone.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude,Roberto Konow 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #include 33 | #include 34 | 35 | using cds::basic::kWordSize; 36 | 37 | namespace cds { 38 | namespace immutable { 39 | 40 | CoderNone::CoderNone() { } 41 | 42 | void CoderNone::Encode(cds_word symb, cds_word *stream, cds_word *pos) const { 43 | stream[*pos / kWordSize] = symb; 44 | *pos += kWordSize; 45 | } 46 | cds_word CoderNone::Decode(cds_word *stream, cds_word *pos) const { 47 | cds_word ret = stream[*pos / kWordSize]; 48 | *pos += kWordSize; 49 | return ret; 50 | } 51 | cds_word CoderNone::MaxLength() const { 52 | return kWordSize; 53 | } 54 | cds_word CoderNone::GetSize() const { 55 | return sizeof(this); 56 | } 57 | void CoderNone::Save(ostream &output) const { 58 | cds_word wr = CODER_NONE_HDR; 59 | cds::basic::SaveValue(output, wr); 60 | } 61 | CoderNone *CoderNone::Load(istream &input) { 62 | cds_word rd; 63 | rd = cds::basic::LoadValue(input); 64 | if (rd != CODER_NONE_HDR) { 65 | return NULL; 66 | } 67 | return new CoderNone(); 68 | } 69 | }; 70 | }; 71 | -------------------------------------------------------------------------------- /src/immutable/mapper.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude,Roberto Konow 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | namespace cds { 37 | namespace immutable { 38 | 39 | Mapper::Mapper() { } 40 | 41 | Mapper *Mapper::Load(istream &input) { 42 | cds_word rd = cds::basic::LoadValue(input); 43 | cds_word pos = input.tellg(); 44 | input.seekg(pos - sizeof(cds_word)); 45 | switch (rd) { 46 | case MAPPER_NONE_HDR: 47 | return MapperNone::Load(input); 48 | // case MAPPER_CONT_HDR: return MapperCont::Load(input); 49 | } 50 | return NULL; 51 | } 52 | }; 53 | }; 54 | -------------------------------------------------------------------------------- /src/immutable/mappernone.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude,Roberto Konow 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #include 33 | #include 34 | 35 | namespace cds { 36 | namespace immutable { 37 | 38 | MapperNone::MapperNone() {} 39 | 40 | cds_word MapperNone::Map(cds_word s) const { 41 | return s; 42 | } 43 | 44 | cds_word MapperNone::Unmap(cds_word s) const { 45 | return s; 46 | } 47 | 48 | cds_word MapperNone::GetSize() const { 49 | return sizeof(MapperNone); 50 | } 51 | 52 | void MapperNone::Save(ostream &out) const { 53 | cds_word wr = MAPPER_NONE_HDR; 54 | cds::basic::SaveValue(out, wr); 55 | } 56 | 57 | MapperNone *MapperNone::Load(istream &input) { 58 | cds_word rd; 59 | rd = cds::basic::LoadValue(input); 60 | if (rd != MAPPER_NONE_HDR) { 61 | return NULL; 62 | } 63 | return new MapperNone(); 64 | } 65 | }; 66 | }; 67 | -------------------------------------------------------------------------------- /src/immutable/permutation.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | 39 | namespace cds { 40 | namespace immutable { 41 | 42 | using cds::basic::CDSException; 43 | using cds::basic::LoadValue; 44 | using cds::basic::SaveValue; 45 | 46 | Permutation *Permutation::Load(istream &fp) { 47 | return NULL; 48 | } 49 | }; 50 | }; 51 | -------------------------------------------------------------------------------- /src/immutable/tree.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #include 33 | #include 34 | 35 | namespace cds { 36 | namespace immutable { 37 | 38 | using cds::basic::LoadValue; 39 | using cds::basic::SaveValue; 40 | 41 | Tree *Tree::Load(istream &fp) { 42 | cds_word rd = LoadValue(fp); 43 | cds_word pos = fp.tellg(); 44 | fp.seekg(pos - sizeof(cds_word)); 45 | switch (rd) { 46 | case kTreeLoudsHdr: 47 | return TreeLouds::Load(fp); 48 | } 49 | return NULL; 50 | } 51 | }; 52 | }; 53 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | # This Makefile is used to build and execute the tests when "make check" 2 | # is run. 3 | 4 | AM_CXXFLAGS = $(PTHREAD_CFLAGS) -I../include/ -I../dep/gtest-1.6.0/include/ 5 | AM_LIBS = $(PTHREAD_LIBS) 6 | 7 | check_PROGRAMS = test_array test_ioh test_libcdsh test_timeh test_bitsequence test_bitsequenceonelevelrank test_sequence test_mappernone test_codernone test_permutationmrrr test_treelouds test_memorymanager 8 | 9 | LDADD = ../dep/gtest-1.6.0/lib/libgtest.la ../lib/libcds$(CDS_API_VERSION).la 10 | test_array_SOURCES = test_array.cpp test_main.cpp 11 | test_ioh_SOURCES = test_ioh.cpp test_main.cpp 12 | test_libcdsh_SOURCES = test_libcdsh.cpp test_main.cpp 13 | test_timeh_SOURCES = test_timeh.cpp test_main.cpp 14 | test_bitsequence_SOURCES = test_bitsequence.cpp \ 15 | test_bitsequence_utils.cpp test_main.cpp 16 | test_bitsequenceonelevelrank_SOURCES = test_bitsequenceonelevelrank.cpp \ 17 | test_bitsequence_utils.cpp test_main.cpp 18 | test_sequence_SOURCES = test_sequence.cpp \ 19 | test_sequence_utils.cpp test_main.cpp 20 | test_mappernone_SOURCES = test_mappernone.cpp test_main.cpp 21 | test_codernone_SOURCES = test_codernone.cpp test_main.cpp 22 | test_permutationmrrr_SOURCES = test_permutationmrrr.cpp test_main.cpp 23 | test_treelouds_SOURCES = test_treelouds.cpp test_main.cpp 24 | test_memorymanager_SOURCES = test_memorymanager.cpp test_main.cpp 25 | 26 | TESTS = $(check_PROGRAMS) 27 | -------------------------------------------------------------------------------- /tests/inputs/input1: -------------------------------------------------------------------------------- 1 | This is an input!!! 2 | -------------------------------------------------------------------------------- /tests/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ./test_array 4 | ./test_libcdsh 5 | ./test_timeh 6 | ./test_ioh 7 | ./test_bitsequence 8 | ./test_bitsequenceonelevelrank 9 | ./test_sequence 10 | -------------------------------------------------------------------------------- /tests/test_basic.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds. nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #include 33 | #include 34 | 35 | #include "./test_libcdsh.h" 36 | #include "./test_ioh.h" 37 | #include "./test_timeh.h" 38 | #include "./test_array.h" 39 | 40 | int main(int argc, char **argv) { 41 | ::testing::InitGoogleTest(&argc, argv); 42 | return RUN_ALL_TESTS(); 43 | } 44 | -------------------------------------------------------------------------------- /tests/test_bitsequence_utils.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #ifndef TESTS_TEST_BITSEQUENCE_UTILS_H_ 33 | #define TESTS_TEST_BITSEQUENCE_UTILS_H_ 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | using cds::basic::Array; 40 | using cds::basic::cds_word; 41 | using cds::immutable::BitSequence; 42 | 43 | Array *CreateRandomBitmap(const cds_word kBitmapLength, const cds_word kOnes, unsigned int seed); 44 | void TestBitSequence(BitSequence *model, BitSequence *tested); 45 | 46 | #endif // TESTS_TEST_BITSEQUENCE_UTILS_H_ 47 | -------------------------------------------------------------------------------- /tests/test_codernone.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude,Roberto Konow 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #include 33 | #include 34 | 35 | using cds::immutable::CoderNone; 36 | using cds::basic::cds_word; 37 | 38 | uint seed_test_array = 20; 39 | 40 | void testCoder(cds_word n) { 41 | CoderNone *cod = new CoderNone(); 42 | cod->Use(); 43 | cds_word *stream = new cds_word[n * 64]; 44 | cds_word pos = 0; 45 | cds_word *symbols = new cds_word[n]; 46 | for (cds_word i = 0 ; i < n ; i++) { 47 | symbols[i] = rand_r(&seed_test_array); 48 | cod->Encode(symbols[i], stream, &pos); 49 | } 50 | 51 | cds_word pos2 = 0; 52 | for (cds_word i = 0 ; i < n ; i++) { 53 | ASSERT_EQ(cod->Decode(stream, &pos2), symbols[i]); 54 | } 55 | cod->Unuse(); 56 | } 57 | 58 | TEST(CoderNone, EncodeRandomElements) { 59 | for (cds_word i = 10; i <= 10000; i += 10) { 60 | testCoder(i); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/test_main.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #include 33 | #include 34 | 35 | int main(int argc, char **argv) { 36 | ::testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /tests/test_mappernone.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude,Roberto Konow 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #include 33 | #include 34 | 35 | using cds::immutable::MapperNone; 36 | using cds::basic::cds_word; 37 | 38 | uint seed_test_array = 20; 39 | 40 | void testMap(cds_word n) { 41 | MapperNone *mn = new MapperNone(); 42 | mn->Use(); 43 | cds_word *symbols = new cds_word[n]; 44 | for (cds_word i = 0 ; i < n ; i++) { 45 | symbols[i] = rand_r(&seed_test_array); 46 | ASSERT_EQ(mn->Map(symbols[i]), symbols[i]); 47 | } 48 | for (cds_word i = 0 ; i < n ; i++) { 49 | ASSERT_EQ(mn->Unmap(symbols[i]), symbols[i]); 50 | } 51 | mn->Unuse(); 52 | } 53 | 54 | TEST(MapperNone, MapRandomElements) { 55 | for (cds_word i = 10; i <= 10000; i += 10) { 56 | testMap(i); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /tests/test_memorymanager.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude,Roberto Konow 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #include 33 | #include 34 | 35 | using cds::dynamic::MemoryManager; 36 | using cds::dynamic::MemoryAddress; 37 | using cds::basic::cds_word; 38 | 39 | uint seed_test_array = 20; 40 | 41 | void testMemMan1(cds_word n, cds_word len) { 42 | MemoryManager *m = new MemoryManager(len, 1024); 43 | MemoryAddress **a = new MemoryAddress*[n]; 44 | 45 | for (cds_word i = 0; i < n; i++) { 46 | a[i] = m->Alloc(len); 47 | m->SetData(a[i], &i); 48 | cds_word num = 0; 49 | m->GetData(a[i], &num); 50 | ASSERT_EQ(i, num); 51 | MemoryAddress *ptr = cds::dynamic::GetPtr(a[i]->ptr, a[i]->len, a[i]->offset); 52 | ASSERT_EQ(a[i], ptr); 53 | } 54 | for (cds_word i = 0; i < n; i++) { 55 | MemoryAddress *ptr = cds::dynamic::GetPtr(a[i]->ptr, a[i]->len, a[i]->offset); 56 | ASSERT_EQ(a[i], ptr); 57 | } 58 | 59 | for (cds_word i = 0; i < n; i++) { 60 | MemoryAddress *ptr = cds::dynamic::GetPtr(a[i]->ptr, a[i]->len, a[i]->offset); 61 | ASSERT_EQ(a[i], ptr); 62 | cds_word num = 0; 63 | m->GetData(a[i], &num); 64 | ASSERT_EQ(i, num); 65 | m->Free(a[i]); 66 | delete a[i]; 67 | } 68 | 69 | delete []a; 70 | delete m; 71 | } 72 | 73 | TEST(MemoryManager, Cycle) { 74 | for (cds_word i = 10000; i <= 100000; i += 10000) { 75 | std::cout << "Running i=" << i << std::endl; 76 | testMemMan1(i, cds::basic::msb(i)); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /tests/test_sequence_utils.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #ifndef TESTS_TEST_SEQUENCE_UTILS_H_ 33 | #define TESTS_TEST_SEQUENCE_UTILS_H_ 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | using cds::basic::Array; 40 | using cds::basic::cds_word; 41 | using cds::immutable::Sequence; 42 | 43 | Array *CreateRandomSequence(const cds_word length, const cds_word sigma, unsigned int seed); 44 | void TestSequence(Sequence *model, Sequence *tested, bool save_and_load); 45 | 46 | #endif // TESTS_TEST_SEQUENCE_UTILS_H_ 47 | -------------------------------------------------------------------------------- /tests/test_timeh.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | Copyright (c) 2012, Francisco Claude. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of libcds nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ********************************************************************************/ 31 | 32 | #include 33 | #include 34 | 35 | #include 36 | 37 | using cds::basic::Timer; 38 | 39 | int sleepTime = 0; 40 | int keepWaiting = 1; 41 | 42 | void testTimer(int i) { 43 | Timer t; 44 | sleep(i); 45 | t.Stop(); 46 | double diff = abs(t.ElapsedTime() - i * 1000000.0); 47 | EXPECT_GE(std::max(t.ElapsedTime() / 20, 100.0), diff); 48 | } 49 | 50 | TEST(Sleep, 0_10Seconds) { 51 | for (int i = 0; i <= 10; i++) { 52 | testTimer(i); 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /tutorials/tutorialSPIRE2012.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fclaude/libcds2/441c126fb06888840761e60087193dbdae646921/tutorials/tutorialSPIRE2012.pdf --------------------------------------------------------------------------------