Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
ccat3z committed Mar 10, 2025
1 parent 86cb522 commit 29847c9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 36 deletions.
14 changes: 5 additions & 9 deletions velox/type/fuzzer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ find_package(Java COMPONENTS Development)
if(Java_Development_FOUND)
add_custom_command(
OUTPUT FloatGenerator.class
COMMAND ${Java_JAVAC_EXECUTABLE} -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/FloatGenerator.java
COMMAND ${Java_JAVAC_EXECUTABLE} -d ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/FloatGenerator.java
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/FloatGenerator.java
)
add_custom_target(java_float_generator DEPENDS FloatGenerator.class)

add_executable(
velox_float_to_string_fuzzer
FloatToStringFuzzer.cpp)
add_executable(velox_float_to_string_fuzzer FloatToStringFuzzer.cpp)
add_test(float_to_string_fuzzer float_to_string_fuzzer)

target_link_libraries(
Expand All @@ -37,8 +36,5 @@ if(Java_Development_FOUND)
gflags::gflags
glog::glog)

add_dependencies(
velox_float_to_string_fuzzer
java_float_generator
)
endif()
add_dependencies(velox_float_to_string_fuzzer java_float_generator)
endif()
15 changes: 15 additions & 0 deletions velox/type/fuzzer/FloatGenerator.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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
*
* 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.
*/
import java.util.Random;

public class FloatGenerator {
Expand Down
2 changes: 1 addition & 1 deletion velox/type/fuzzer/FloatToStringFuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void testCastToVarchar(
// Old java (< 19) may produce longer or incorrect decimal.
// See https://bugs.openjdk.org/browse/JDK-4511638.
// e.g.
// Actual | JDK <= 18 | JDK 19
// Actual | JDK <= 18 | JDK 19
// 7.5371334E25 | 7.5371335E25 | 7.5371334E25 # incorrect
// 1.0E23 | 9.999999999999999E22 | 1.0E23 # longer
if (buggyJavaVersion) {
Expand Down
33 changes: 7 additions & 26 deletions velox/type/tests/ConversionsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,32 +756,13 @@ TEST_F(ConversionsTest, toString) {
-std::numeric_limits<float>::quiet_NaN(),
},
{
"1.2345678E19",
"1.2345678E8",
"1.0E7",
"12345.0",
"0.001",
"1.2E-4",
"0.0",
"-0.0",
"-1.2E-4",
"-0.001",
"-12345.0",
"-1.0E7",
"-1.2345678E8",
"-1.2345678E19",
"-9.84E31",
"1.8E-17",
"-6.1E-25",
"9.2E27",
"1.26900006E17",
"-9.9E-4",
"7.515E-5",
"-6.5805E27",
"Infinity",
"-Infinity",
"NaN",
"NaN",
"1.2345678E19", "1.2345678E8", "1.0E7", "12345.0",
"0.001", "1.2E-4", "0.0", "-0.0",
"-1.2E-4", "-0.001", "-12345.0", "-1.0E7",
"-1.2345678E8", "-1.2345678E19", "-9.84E31", "1.8E-17",
"-6.1E-25", "9.2E27", "1.26900006E17", "-9.9E-4",
"7.515E-5", "-6.5805E27", "Infinity", "-Infinity",
"NaN", "NaN",
},
false,
/*legacyCast*/ false);
Expand Down

0 comments on commit 29847c9

Please sign in to comment.