Revert "pioasm: fix fractional part of .clock_div (#3190)"

This reverts commit 74cc22a0a719c2a2b20721eb879ba24f77430486.
diff --git a/tools/pioasm/CMakeLists.txt b/tools/pioasm/CMakeLists.txt
index fe59ec1..eafa071 100644
--- a/tools/pioasm/CMakeLists.txt
+++ b/tools/pioasm/CMakeLists.txt
@@ -62,12 +62,6 @@
     target_compile_options(pioasm PRIVATE "/std:c++latest")
 endif()
 
-option(PIOASM_BUILD_TESTS "Build pioasm tests (run them with ctest)" OFF)
-if (PIOASM_BUILD_TESTS)
-    enable_testing()
-    add_subdirectory(test)
-endif()
-
 
 # allow installing to flat dir
 include(GNUInstallDirs)
diff --git a/tools/pioasm/pio_assembler.cpp b/tools/pioasm/pio_assembler.cpp
index fd77687..a36854b 100644
--- a/tools/pioasm/pio_assembler.cpp
+++ b/tools/pioasm/pio_assembler.cpp
@@ -69,7 +69,7 @@
     if (clock_div_int == 0) {
         clock_div_frac = 0;
     } else {
-        clock_div_frac = (uint8_t)((clock_div - (float)clock_div_int) * (1u << 8u));
+        clock_div_frac = (uint8_t)((clock_div - (float)clock_div_frac) * (1u << 8u));
     }
 }
 
diff --git a/tools/pioasm/test/CMakeLists.txt b/tools/pioasm/test/CMakeLists.txt
deleted file mode 100644
index 906c4e9..0000000
--- a/tools/pioasm/test/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Golden-output tests: assemble a fixture with the freshly built pioasm and
-# compare the result against a checked-in expected file. Configure with
-# -DPIOASM_BUILD_TESTS=ON, then run with `ctest`.
-#
-# To regenerate an expected file after an intentional output change, run
-# pioasm by hand and check the result carefully before committing it:
-#   pioasm -o c-sdk clock_div.pio clock_div.c-sdk.expected
-#   pioasm -o json  clock_div.pio clock_div.json.expected
-#
-# The expected files deliberately avoid C/C++ extensions so that the Bazel
-# source-coverage check does not mistake them for headers.
-
-function(pioasm_add_output_test NAME INPUT FORMAT EXPECTED)
-    add_test(NAME ${NAME}
-        COMMAND ${CMAKE_COMMAND}
-            -DPIOASM=$<TARGET_FILE:pioasm>
-            -DINPUT=${CMAKE_CURRENT_LIST_DIR}/${INPUT}
-            -DFORMAT=${FORMAT}
-            -DEXPECTED=${CMAKE_CURRENT_LIST_DIR}/${EXPECTED}
-            -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/${NAME}.out
-            -P ${CMAKE_CURRENT_LIST_DIR}/compare_output.cmake
-    )
-endfunction()
-
-pioasm_add_output_test(clock_div_c_sdk clock_div.pio c-sdk clock_div.c-sdk.expected)
-pioasm_add_output_test(clock_div_json  clock_div.pio json  clock_div.json.expected)
diff --git a/tools/pioasm/test/clock_div.c-sdk.expected b/tools/pioasm/test/clock_div.c-sdk.expected
deleted file mode 100644
index 4adcf4e..0000000
--- a/tools/pioasm/test/clock_div.c-sdk.expected
+++ /dev/null
@@ -1,147 +0,0 @@
-// ---------------------------------------------------------------- //
-// This file is autogenerated by pioasm version 2.3.2; do not edit! //
-// ---------------------------------------------------------------- //
-
-#pragma once
-
-#if !PICO_NO_HARDWARE
-#include "hardware/pio.h"
-#endif
-
-#ifdef __cpp_constexpr
-#define __pio_const constexpr
-#else
-#define __pio_const const
-#endif
-
-// ------- //
-// div_3_6 //
-// ------- //
-
-#define div_3_6_wrap_target 0
-#define div_3_6_wrap 0
-#define div_3_6_pio_version 0
-
-static __pio_const uint16_t div_3_6_program_instructions[] = {
-            //     .wrap_target
-    0xa042, //  0: nop
-            //     .wrap
-};
-
-#if !PICO_NO_HARDWARE
-static __pio_const struct pio_program div_3_6_program = {
-    .instructions = div_3_6_program_instructions,
-    .length = 1,
-    .origin = -1,
-    .pio_version = div_3_6_pio_version,
-#if PICO_PIO_VERSION > 0
-    .used_gpio_ranges = 0x0
-#endif
-};
-
-static inline pio_sm_config div_3_6_program_get_default_config(uint offset) {
-    pio_sm_config c = pio_get_default_sm_config();
-    sm_config_set_wrap(&c, offset + div_3_6_wrap_target, offset + div_3_6_wrap);
-    sm_config_set_clkdiv_int_frac(&c, 3, 153);
-    return c;
-}
-#endif
-
-// ------- //
-// div_2_5 //
-// ------- //
-
-#define div_2_5_wrap_target 0
-#define div_2_5_wrap 0
-#define div_2_5_pio_version 0
-
-static __pio_const uint16_t div_2_5_program_instructions[] = {
-            //     .wrap_target
-    0xa042, //  0: nop
-            //     .wrap
-};
-
-#if !PICO_NO_HARDWARE
-static __pio_const struct pio_program div_2_5_program = {
-    .instructions = div_2_5_program_instructions,
-    .length = 1,
-    .origin = -1,
-    .pio_version = div_2_5_pio_version,
-#if PICO_PIO_VERSION > 0
-    .used_gpio_ranges = 0x0
-#endif
-};
-
-static inline pio_sm_config div_2_5_program_get_default_config(uint offset) {
-    pio_sm_config c = pio_get_default_sm_config();
-    sm_config_set_wrap(&c, offset + div_2_5_wrap_target, offset + div_2_5_wrap);
-    sm_config_set_clkdiv_int_frac(&c, 2, 128);
-    return c;
-}
-#endif
-
-// ------ //
-// div_50 //
-// ------ //
-
-#define div_50_wrap_target 0
-#define div_50_wrap 0
-#define div_50_pio_version 0
-
-static __pio_const uint16_t div_50_program_instructions[] = {
-            //     .wrap_target
-    0xa042, //  0: nop
-            //     .wrap
-};
-
-#if !PICO_NO_HARDWARE
-static __pio_const struct pio_program div_50_program = {
-    .instructions = div_50_program_instructions,
-    .length = 1,
-    .origin = -1,
-    .pio_version = div_50_pio_version,
-#if PICO_PIO_VERSION > 0
-    .used_gpio_ranges = 0x0
-#endif
-};
-
-static inline pio_sm_config div_50_program_get_default_config(uint offset) {
-    pio_sm_config c = pio_get_default_sm_config();
-    sm_config_set_wrap(&c, offset + div_50_wrap_target, offset + div_50_wrap);
-    sm_config_set_clkdiv_int_frac(&c, 50, 0);
-    return c;
-}
-#endif
-
-// ----- //
-// div_1 //
-// ----- //
-
-#define div_1_wrap_target 0
-#define div_1_wrap 0
-#define div_1_pio_version 0
-
-static __pio_const uint16_t div_1_program_instructions[] = {
-            //     .wrap_target
-    0xa042, //  0: nop
-            //     .wrap
-};
-
-#if !PICO_NO_HARDWARE
-static __pio_const struct pio_program div_1_program = {
-    .instructions = div_1_program_instructions,
-    .length = 1,
-    .origin = -1,
-    .pio_version = div_1_pio_version,
-#if PICO_PIO_VERSION > 0
-    .used_gpio_ranges = 0x0
-#endif
-};
-
-static inline pio_sm_config div_1_program_get_default_config(uint offset) {
-    pio_sm_config c = pio_get_default_sm_config();
-    sm_config_set_wrap(&c, offset + div_1_wrap_target, offset + div_1_wrap);
-    return c;
-}
-#endif
-
diff --git a/tools/pioasm/test/clock_div.json.expected b/tools/pioasm/test/clock_div.json.expected
deleted file mode 100644
index d36434d..0000000
--- a/tools/pioasm/test/clock_div.json.expected
+++ /dev/null
@@ -1,119 +0,0 @@
-{
-	"pioASMVersion": "2.3.2",
-	"publicSymbols": {
-	},
-	"programs": [
-		{
-			"name": "div_3_6",
-			"pioVersion": 0,
-			"wrapTarget": 0,
-			"wrap": 0,
-			"origin": -1,
-			"usedGPIORanges": 0,
-			"publicSymbols": {
-			},
-			"publicLabels": {
-			},
-			"in": null,
-			"out": null,
-			"setCount": null,
-			"sideset": null,
-			"movStatus": null,
-			"fifoConfig": null,
-			"clockDiv": {"int": 3, "frac": 153},
-			"instructions": [
-				{"hex": "A042", "instruction": "nop"}
-			],
-			"codeBlocks": [
-
-			],
-			"langOpts": [
-
-			]
-		},
-		{
-			"name": "div_2_5",
-			"pioVersion": 0,
-			"wrapTarget": 0,
-			"wrap": 0,
-			"origin": -1,
-			"usedGPIORanges": 0,
-			"publicSymbols": {
-			},
-			"publicLabels": {
-			},
-			"in": null,
-			"out": null,
-			"setCount": null,
-			"sideset": null,
-			"movStatus": null,
-			"fifoConfig": null,
-			"clockDiv": {"int": 2, "frac": 128},
-			"instructions": [
-				{"hex": "A042", "instruction": "nop"}
-			],
-			"codeBlocks": [
-
-			],
-			"langOpts": [
-
-			]
-		},
-		{
-			"name": "div_50",
-			"pioVersion": 0,
-			"wrapTarget": 0,
-			"wrap": 0,
-			"origin": -1,
-			"usedGPIORanges": 0,
-			"publicSymbols": {
-			},
-			"publicLabels": {
-			},
-			"in": null,
-			"out": null,
-			"setCount": null,
-			"sideset": null,
-			"movStatus": null,
-			"fifoConfig": null,
-			"clockDiv": {"int": 50, "frac": 0},
-			"instructions": [
-				{"hex": "A042", "instruction": "nop"}
-			],
-			"codeBlocks": [
-
-			],
-			"langOpts": [
-
-			]
-		},
-		{
-			"name": "div_1",
-			"pioVersion": 0,
-			"wrapTarget": 0,
-			"wrap": 0,
-			"origin": -1,
-			"usedGPIORanges": 0,
-			"publicSymbols": {
-			},
-			"publicLabels": {
-			},
-			"in": null,
-			"out": null,
-			"setCount": null,
-			"sideset": null,
-			"movStatus": null,
-			"fifoConfig": null,
-			"clockDiv": null,
-			"instructions": [
-				{"hex": "A042", "instruction": "nop"}
-			],
-			"codeBlocks": [
-
-			],
-			"langOpts": [
-
-			]
-		}
-	]
-}
diff --git a/tools/pioasm/test/clock_div.pio b/tools/pioasm/test/clock_div.pio
deleted file mode 100644
index e8baf3d..0000000
--- a/tools/pioasm/test/clock_div.pio
+++ /dev/null
@@ -1,25 +0,0 @@
-; Regression fixture for the .clock_div directive.
-;
-; pioasm used to compute the fractional part of the divider from the whole
-; divider rather than from its fractional part alone, so `.clock_div 3.6`
-; produced a fraction of 921 instead of 153 (0.6 * 256, truncated).
-; Both output formats emitted the bad value. The generated C code happened to
-; work for this case only because sm_config_set_clkdiv_int_frac() takes a
-; uint8_t, which truncated 921 to the correct 153; the JSON output kept 921.
-
-.program div_3_6
-.clock_div 3.6
-    nop
-
-.program div_2_5
-.clock_div 2.5
-    nop
-
-.program div_50
-.clock_div 50
-    nop
-
-; A divider of 1 is the default and should not produce a clkdiv call at all.
-.program div_1
-.clock_div 1
-    nop
diff --git a/tools/pioasm/test/compare_output.cmake b/tools/pioasm/test/compare_output.cmake
deleted file mode 100644
index 15cc019..0000000
--- a/tools/pioasm/test/compare_output.cmake
+++ /dev/null
@@ -1,41 +0,0 @@
-# Runs pioasm on an input file and compares the generated output against a
-# checked-in expected file. The line carrying the pioasm version string is
-# ignored so the expected files do not need updating on every release.
-#
-# Invoked by add_test() in test/CMakeLists.txt as:
-#   cmake -DPIOASM=<exe> -DINPUT=<file.pio> -DFORMAT=<output format>
-#         -DEXPECTED=<expected file> -DOUTPUT=<file to write> -P compare_output.cmake
-
-foreach(var PIOASM INPUT FORMAT EXPECTED OUTPUT)
-    if (NOT DEFINED ${var})
-        message(FATAL_ERROR "${var} must be defined")
-    endif()
-endforeach()
-
-execute_process(
-    COMMAND "${PIOASM}" -o "${FORMAT}" "${INPUT}" "${OUTPUT}"
-    RESULT_VARIABLE result
-    OUTPUT_VARIABLE stdout
-    ERROR_VARIABLE stderr
-)
-if (NOT result EQUAL 0)
-    message(FATAL_ERROR "pioasm failed (exit code ${result}) on ${INPUT}:\n${stdout}${stderr}")
-endif()
-
-# Normalise line endings and drop the version line before comparing.
-function(normalise_output in_file out_var)
-    file(READ "${in_file}" contents)
-    string(REPLACE "\r\n" "\n" contents "${contents}")
-    string(REGEX REPLACE "[^\n]*(autogenerated by pioasm version|\"pioASMVersion\")[^\n]*\n" "" contents "${contents}")
-    set(${out_var} "${contents}" PARENT_SCOPE)
-endfunction()
-
-normalise_output("${OUTPUT}" actual)
-normalise_output("${EXPECTED}" expected)
-
-if (NOT actual STREQUAL expected)
-    message(FATAL_ERROR
-        "pioasm '${FORMAT}' output for ${INPUT} does not match ${EXPECTED}\n"
-        "Actual output was written to ${OUTPUT}\n"
-        "--- expected ---\n${expected}\n--- actual ---\n${actual}")
-endif()