Skip to content

Commit

Permalink
Merge branch 'master' into remove-unused-assert-option
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacbrodsky committed Dec 23, 2024
2 parents 6f51a8e + ae31177 commit cb7d7b7
Show file tree
Hide file tree
Showing 61 changed files with 880 additions and 414 deletions.
2 changes: 2 additions & 0 deletions .cmake-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
format:
tab_size: 4
2 changes: 1 addition & 1 deletion .github/workflows/test-fuzzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ jobs:
cd build
for fuzzer in bin/fuzzer*; do
echo $fuzzer
$fuzzer -runs=100000 -max_total_time=60 -timeout=120
$fuzzer -runs=100000 -max_total_time=60 -timeout=300
done
432 changes: 249 additions & 183 deletions CMakeLists.txt

Large diffs are not rendered by default.

195 changes: 123 additions & 72 deletions CMakeTests.cmake

Large diffs are not rendered by default.

35 changes: 18 additions & 17 deletions cmake/TestWrapValgrind.cmake
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
# Copyright 2018 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# Support code for wrapping tests or other executables with Valgrind.

if(__test_wrap_valgrind)
return()
return()
endif()
set(__test_wrap_valgrind 1)

include(CMakeDependentOption)

find_program(VALGRIND valgrind)
cmake_dependent_option(WRAP_VALGRIND "Wrap tests in valgrind" OFF
"VALGRIND" OFF)
cmake_dependent_option(WRAP_VALGRIND "Wrap tests in valgrind" OFF "VALGRIND"
OFF)
if(WRAP_VALGRIND)
# TEST_WRAPPER could be used to configure the Valgrind parameters, or
# to use a different wrapper entirely.
set(TEST_WRAPPER ${VALGRIND} --track-origins=yes --leak-check=full --error-exitcode=99 CACHE STRING
"Wrapper executable for tests and benchmarks")
# TEST_WRAPPER could be used to configure the Valgrind parameters, or to use
# a different wrapper entirely.
set(TEST_WRAPPER
${VALGRIND} --track-origins=yes --leak-check=full --error-exitcode=99
CACHE STRING "Wrapper executable for tests and benchmarks")
mark_as_advanced(TEST_WRAPPER)
# Convert from semicolon separated list of values to a form
# that can be used by a shell.
# Convert from semicolon separated list of values to a form that can be used
# by a shell.
string(REPLACE ";" " " TEST_WRAPPER_STR "${TEST_WRAPPER}")
endif()
12 changes: 9 additions & 3 deletions tests/cli/areNeighborCells.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
add_h3_cli_test(testCliAreNeighborCells "areNeighborCells -o 85283473fffffff -d 85283477fffffff" "true")
add_h3_cli_test(testCliAreNotNeighborCells "areNeighborCells -o 85283473fffffff -d 85283472fffffff" "false")
add_h3_cli_test(testCliAreNeighborNotCells "areNeighborCells -o 85283473fffffff -d 852834727fffffff 2>&1" "Error 5: Cell argument was not valid")
add_h3_cli_test(testCliAreNeighborCells
"areNeighborCells -o 85283473fffffff -d 85283477fffffff" "true")
add_h3_cli_test(
testCliAreNotNeighborCells
"areNeighborCells -o 85283473fffffff -d 85283472fffffff" "false")
add_h3_cli_test(
testCliAreNeighborNotCells
"areNeighborCells -o 85283473fffffff -d 852834727fffffff 2>&1"
"Error 5: Cell argument was not valid")
6 changes: 4 additions & 2 deletions tests/cli/cellAreaKm2.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
add_h3_cli_test(testCliCellAreaKm2 "cellAreaKm2 -c 85283473fffffff" "265.0925581283")
add_h3_cli_test(testCliNotCellAreaKm2 "cellAreaKm2 -c 115283473fffffff 2>&1" "Error 5: Cell argument was not valid")
add_h3_cli_test(testCliCellAreaKm2 "cellAreaKm2 -c 85283473fffffff"
"265.0925581283")
add_h3_cli_test(testCliNotCellAreaKm2 "cellAreaKm2 -c 115283473fffffff 2>&1"
"Error 5: Cell argument was not valid")
7 changes: 5 additions & 2 deletions tests/cli/cellAreaM2.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
add_h3_cli_test(testCliCellAreaM2 "cellAreaM2 -c 85283473fffffff | xargs printf '%.3f'" "265092558.128")
add_h3_cli_test(testCliNotCellAreaM2 "cellAreaM2 -c 115283473fffffff 2>&1" "Error 5: Cell argument was not valid")
add_h3_cli_test(
testCliCellAreaM2 "cellAreaM2 -c 85283473fffffff | xargs printf '%.3f'"
"265092558.128")
add_h3_cli_test(testCliNotCellAreaM2 "cellAreaM2 -c 115283473fffffff 2>&1"
"Error 5: Cell argument was not valid")
7 changes: 5 additions & 2 deletions tests/cli/cellAreaRads2.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
add_h3_cli_test(testCliCellAreaRads2 "cellAreaRads2 -c 85283473fffffff" "0.0000065310")
add_h3_cli_test(testCliNotCellAreaRads2 "cellAreaRads2 -c 115283473fffffff 2>&1" "Error 5: Cell argument was not valid")
add_h3_cli_test(testCliCellAreaRads2 "cellAreaRads2 -c 85283473fffffff"
"0.0000065310")
add_h3_cli_test(
testCliNotCellAreaRads2 "cellAreaRads2 -c 115283473fffffff 2>&1"
"Error 5: Cell argument was not valid")
6 changes: 5 additions & 1 deletion tests/cli/cellToBoundary.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
add_h3_cli_test(testCliCellToBoundary "cellToBoundary -c 8928342e20fffff -f wkt" "POLYGON((-122.4990471431 37.4997389893, -122.4979805011 37.5014245698, -122.4992373065 37.5029321860, -122.5015607527 37.5027541980, -122.5026273256 37.5010686174, -122.5013705214 37.4995610248, -122.4990471431 37.4997389893))")
add_h3_cli_test(
testCliCellToBoundary
"cellToBoundary -c 8928342e20fffff -f wkt"
"POLYGON((-122.4990471431 37.4997389893, -122.4979805011 37.5014245698, -122.4992373065 37.5029321860, -122.5015607527 37.5027541980, -122.5026273256 37.5010686174, -122.5013705214 37.4995610248, -122.4990471431 37.4997389893))"
)
5 changes: 4 additions & 1 deletion tests/cli/cellToCenterChild.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
add_h3_cli_test(testCliCellToCenterChild "cellToCenterChild -c 85283473fffffff --resolution 7 -f newline" "872834700ffffff")
add_h3_cli_test(
testCliCellToCenterChild
"cellToCenterChild -c 85283473fffffff --resolution 7 -f newline"
"872834700ffffff")
3 changes: 2 additions & 1 deletion tests/cli/cellToChildPos.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_h3_cli_test(testCliCellToChildPos "cellToChildPos -c 85283473fffffff -r 3" "25")
add_h3_cli_test(testCliCellToChildPos "cellToChildPos -c 85283473fffffff -r 3"
"25")
6 changes: 5 additions & 1 deletion tests/cli/cellToChildren.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
add_h3_cli_test(testCliCellToChildren "cellToChildren -c 85283473fffffff -r 6" "[ \"862834707ffffff\", \"86283470fffffff\", \"862834717ffffff\", \"86283471fffffff\", \"862834727ffffff\", \"86283472fffffff\", \"862834737ffffff\" ]")
add_h3_cli_test(
testCliCellToChildren
"cellToChildren -c 85283473fffffff -r 6"
"[ \"862834707ffffff\", \"86283470fffffff\", \"862834717ffffff\", \"86283471fffffff\", \"862834727ffffff\", \"86283472fffffff\", \"862834737ffffff\" ]"
)
3 changes: 2 additions & 1 deletion tests/cli/cellToChildrenSize.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_h3_cli_test(testCliCellToChildrenSize "cellToChildrenSize -c 85283473fffffff -r 6" "7")
add_h3_cli_test(testCliCellToChildrenSize
"cellToChildrenSize -c 85283473fffffff -r 6" "7")
6 changes: 4 additions & 2 deletions tests/cli/cellToLatLng.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
add_h3_cli_test(testCliCellToLatLng "cellToLatLng -c 8928342e20fffff -f wkt" "POINT(-122.5003039349 37.5012466151)")
add_h3_cli_test(testCliInvalidCellToLatLng "cellToLatLng -c asdf 2>&1" "Error 5: Cell argument was not valid")
add_h3_cli_test(testCliCellToLatLng "cellToLatLng -c 8928342e20fffff -f wkt"
"POINT(-122.5003039349 37.5012466151)")
add_h3_cli_test(testCliInvalidCellToLatLng "cellToLatLng -c asdf 2>&1"
"Error 5: Cell argument was not valid")
4 changes: 3 additions & 1 deletion tests/cli/cellToLocalIj.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
add_h3_cli_test(testCliCellToLocalIj "cellToLocalIj -o 85283473fffffff -c 8528342bfffffff" "[25, 13]")
add_h3_cli_test(
testCliCellToLocalIj "cellToLocalIj -o 85283473fffffff -c 8528342bfffffff"
"[25, 13]")
5 changes: 4 additions & 1 deletion tests/cli/cellToParent.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
add_h3_cli_test(testCliCellToParent "cellToParent -c 8928342e20fffff --resolution 3 -f newline" "832834fffffffff")
add_h3_cli_test(
testCliCellToParent
"cellToParent -c 8928342e20fffff --resolution 3 -f newline"
"832834fffffffff")
8 changes: 6 additions & 2 deletions tests/cli/cellToVertex.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
add_h3_cli_test(testCliCellToVertex "cellToVertex -c 85283473fffffff -v 0 -f newline" "22528340bfffffff")
add_h3_cli_test(testCliNotCellToVertex "cellToVertex -c 115283473fffffff -v 0 2>&1" "Error 5: Cell argument was not valid")
add_h3_cli_test(
testCliCellToVertex "cellToVertex -c 85283473fffffff -v 0 -f newline"
"22528340bfffffff")
add_h3_cli_test(
testCliNotCellToVertex "cellToVertex -c 115283473fffffff -v 0 2>&1"
"Error 5: Cell argument was not valid")
10 changes: 8 additions & 2 deletions tests/cli/cellToVertexes.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
add_h3_cli_test(testCliCellToVertexes "cellToVertexes -c 85283473fffffff" "[ \"22528340bfffffff\", \"235283447fffffff\", \"205283463fffffff\", \"255283463fffffff\", \"22528340ffffffff\", \"23528340bfffffff\" ]")
add_h3_cli_test(testCliNotCellToVertexes "cellToVertexes -c 115283473fffffff 2>&1" "Error 5: Cell argument was not valid")
add_h3_cli_test(
testCliCellToVertexes
"cellToVertexes -c 85283473fffffff"
"[ \"22528340bfffffff\", \"235283447fffffff\", \"205283463fffffff\", \"255283463fffffff\", \"22528340ffffffff\", \"23528340bfffffff\" ]"
)
add_h3_cli_test(
testCliNotCellToVertexes "cellToVertexes -c 115283473fffffff 2>&1"
"Error 5: Cell argument was not valid")
10 changes: 8 additions & 2 deletions tests/cli/cellsToDirectedEdge.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
add_h3_cli_test(testCliCellsToDirectedEdge "cellsToDirectedEdge -o 85283473fffffff -d 85283477fffffff -f newline" "115283473fffffff")
add_h3_cli_test(testCliCellsNotToDirectedEdge "cellsToDirectedEdge -o 85283473fffffff -d 85283472fffffff 2>&1" "Error 11: Cell arguments were not neighbors")
add_h3_cli_test(
testCliCellsToDirectedEdge
"cellsToDirectedEdge -o 85283473fffffff -d 85283477fffffff -f newline"
"115283473fffffff")
add_h3_cli_test(
testCliCellsNotToDirectedEdge
"cellsToDirectedEdge -o 85283473fffffff -d 85283472fffffff 2>&1"
"Error 11: Cell arguments were not neighbors")
Loading

0 comments on commit cb7d7b7

Please sign in to comment.