load("@fbcode//quic:defs.bzl", "mvfst_cpp_library")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")

oncall("traffic_protocols")

mvfst_cpp_library(
    name = "mocks",
    headers = [
        "Mocks.h",
    ],
    exported_deps = [
        "//folly/portability:gmock",
        "//quic/congestion_control:bbr",
    ],
)

mvfst_cpp_library(
    name = "TestingCubic",
    headers = [
        "TestingCubic.h",
    ],
    exported_deps = [
        "//quic/congestion_control:cubic",
    ],
)

cpp_unittest(
    name = "CongestionControlFunctionsTest",
    srcs = [
        "CongestionControlFunctionsTest.cpp",
    ],
    deps = [
        "//folly/portability:gtest",
        "//quic:constants",
        "//quic/congestion_control:congestion_control_functions",
        "//quic/state:quic_state_machine",
    ],
)

cpp_unittest(
    name = "CubicStateTest",
    srcs = [
        "CubicStateTest.cpp",
    ],
    deps = [
        ":TestingCubic",
        "//folly/portability:gtest",
        "//quic/common/test:test_utils",
    ],
)

cpp_unittest(
    name = "CubicTest",
    srcs = [
        "CubicHystartTest.cpp",
        "CubicRecoveryTest.cpp",
        "CubicSteadyTest.cpp",
        "CubicTest.cpp",
    ],
    deps = [
        ":TestingCubic",
        "//folly/portability:gtest",
        "//quic/common/test:test_utils",
        "//quic/congestion_control:cubic",
        "//quic/state/test:mocks",
    ],
)

cpp_unittest(
    name = "NewRenoTest",
    srcs = [
        "NewRenoTest.cpp",
    ],
    deps = [
        "//folly/portability:gtest",
        "//quic/common/test:test_utils",
        "//quic/congestion_control:newreno",
        "//quic/fizz/server/handshake:fizz_server_handshake",
    ],
)

cpp_unittest(
    name = "CopaTest",
    srcs = [
        "CopaTest.cpp",
    ],
    deps = [
        "//folly/portability:gtest",
        "//quic/common/test:test_utils",
        "//quic/congestion_control:copa",
        "//quic/fizz/server/handshake:fizz_server_handshake",
        "//quic/state/test:mocks",
    ],
)

cpp_unittest(
    name = "BbrTest",
    srcs = [
        "BbrTest.cpp",
    ],
    deps = [
        ":mocks",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//quic/common/test:test_utils",
        "//quic/congestion_control:bbr",
        "//quic/congestion_control:bbr_bandwidth_sampler",
        "//quic/state/test:mocks",
    ],
)

cpp_unittest(
    name = "BbrRttSamplerTest",
    srcs = [
        "BbrRttSamplerTest.cpp",
    ],
    deps = [
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//quic/congestion_control:bbr_rtt_sampler",
    ],
)

cpp_unittest(
    name = "BbrBandwidthSamplerTest",
    srcs = [
        "BbrBandwidthSamplerTest.cpp",
    ],
    deps = [
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//quic/common/test:test_utils",
        "//quic/congestion_control:bbr_bandwidth_sampler",
    ],
)

cpp_unittest(
    name = "BandwidthTest",
    srcs = [
        "BandwidthTest.cpp",
    ],
    deps = [
        "//folly/portability:gtest",
        "//quic/congestion_control:bandwidth",
    ],
)

cpp_unittest(
    name = "PacerTest",
    srcs = [
        "PacerTest.cpp",
    ],
    deps = [
        "//folly/portability:gtest",
        "//quic/congestion_control:pacer",
        "//quic/state/test:mocks",
    ],
)

cpp_unittest(
    name = "StaticCwndCongestionControllerTest",
    srcs = [
        "StaticCwndCongestionControllerTest.cpp",
    ],
    deps = [
        ":mocks",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//quic/common/test:test_utils",
        "//quic/congestion_control:bbr",
        "//quic/congestion_control:static_cwnd_congestion_controller",
        "//quic/state/test:mocks",
    ],
)

cpp_unittest(
    name = "SimulatedTBFTest",
    srcs = [
        "SimulatedTBFTest.cpp",
    ],
    deps = [
        "//folly/portability:gtest",
        "//quic:exception",
        "//quic/congestion_control:simulated_tbf",
    ],
)

cpp_unittest(
    name = "ThrottlingSignalProviderTest",
    srcs = [
        "ThrottlingSignalProviderTest.cpp",
    ],
    deps = [
        "//quic/api:transport",
        "//quic/common/test:test_utils",
        "//quic/congestion_control:bbr",
        "//quic/congestion_control:bbr_bandwidth_sampler",
        "//quic/congestion_control:simulated_tbf",
        "//quic/congestion_control:throttling_signal_provider",
        "//quic/state/test:mocks",
    ],
)

cpp_unittest(
    name = "Bbr2Test",
    srcs = [
        "Bbr2Test.cpp",
    ],
    deps = [
        ":mocks",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//quic/common/test:test_utils",
        "//quic/congestion_control:bbr2",
        "//quic/state/test:mocks",
    ],
)

cpp_unittest(
    name = "EcnL4sTrackerTest",
    srcs = [
        "EcnL4sTrackerTest.cpp",
    ],
    deps = [
        "//folly/portability:gtest",
        "//quic/api/test:mocks",
        "//quic/congestion_control:ecn_l4s_tracker",
    ],
)
