Skip to content

Commit f0cc92d

Browse files
authored
fix: Change float to double as in the update of the spec (#44)
1 parent 106fbf3 commit f0cc92d

File tree

10 files changed

+16
-14
lines changed

10 files changed

+16
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## [Unreleased](https://github.com/rdkcentral/firebolt-cpp-client/compare/v0.5.0...main)
22

33
### Changed
4-
- Corrected type from integer to unsigned in TTS (uint32_t)
4+
- **Breaking**: Aligned types with the latest specification updates:
5+
- `integer` changed to unsigned (`uint32_t`)
6+
- `float` changed to `double`
57

68
## [0.5.0](https://github.com/rdkcentral/firebolt-cpp-client/compare/v0.4.0...v0.5.0)
79

include/firebolt/accessibility.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct ClosedCaptionsSettings
3535
struct VoiceGuidanceSettings
3636
{
3737
bool enabled;
38-
float rate;
38+
double rate;
3939
bool navigationHints;
4040
};
4141

include/firebolt/discovery.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class IDiscovery
4747
*
4848
* @retval The status.
4949
*/
50-
virtual Result<bool> watched(const std::string& entityId, std::optional<float> progress,
50+
virtual Result<bool> watched(const std::string& entityId, std::optional<double> progress,
5151
std::optional<bool> completed, std::optional<std::string> watchedOn,
5252
std::optional<AgePolicy> agePolicy) const = 0;
5353
};

src/discovery_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ DiscoveryImpl::DiscoveryImpl(Firebolt::Helpers::IHelper& helper)
2727
{
2828
}
2929

30-
Result<bool> DiscoveryImpl::watched(const std::string& entityId, std::optional<float> progress,
30+
Result<bool> DiscoveryImpl::watched(const std::string& entityId, std::optional<double> progress,
3131
std::optional<bool> completed, std::optional<std::string> watchedOn,
3232
std::optional<AgePolicy> agePolicy) const
3333
{

src/discovery_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class DiscoveryImpl : public IDiscovery
3232

3333
~DiscoveryImpl() override = default;
3434

35-
Result<bool> watched(const std::string& entityId, std::optional<float> progress, std::optional<bool> completed,
35+
Result<bool> watched(const std::string& entityId, std::optional<double> progress, std::optional<bool> completed,
3636
std::optional<std::string> watchedOn, std::optional<AgePolicy> agePolicy) const override;
3737

3838
private:

src/json_types/jsondata_accessibility_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class VoiceGuidanceSettings : public Firebolt::JSON::NL_Json_Basic<::Firebolt::A
4848
void fromJson(const nlohmann::json& json) override
4949
{
5050
enabled_ = json["enabled"].get<bool>();
51-
rate_ = json["rate"].get<float>();
51+
rate_ = json["rate"].get<double>();
5252
navigationHints_ = json["navigationHints"].get<bool>();
5353
}
5454
::Firebolt::Accessibility::VoiceGuidanceSettings value() const override
@@ -58,7 +58,7 @@ class VoiceGuidanceSettings : public Firebolt::JSON::NL_Json_Basic<::Firebolt::A
5858

5959
private:
6060
bool enabled_;
61-
float rate_;
61+
double rate_;
6262
bool navigationHints_;
6363
};
6464

test/api_test_app/apis/discoveryDemo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ void DiscoveryDemo::runOption(const std::string& method)
4242
if (method == "Discovery.watched")
4343
{
4444
std::string entityId = paramFromConsole("entityId", "exampleEntityId");
45-
std::optional<float> progress = 0.5;
45+
std::optional<double> progress = 0.5;
4646
try
4747
{
48-
progress = std::stof(
48+
progress = std::stod(
4949
paramFromConsole("progress (percentage as (0-0.999) for VOD, number of seconds for live)", "0.5"));
5050
}
5151
catch (const std::exception&)

test/component/accessibilityTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ TEST_F(AccessibilityTest, VoiceGuidanceSettings)
152152

153153
ASSERT_TRUE(result) << "AccessibilityImpl::voiceGuidanceSettings() returned an error";
154154
EXPECT_EQ((*result).enabled, expectedValue.at("enabled").get<bool>());
155-
EXPECT_EQ((*result).rate, expectedValue.at("rate").get<float>());
155+
EXPECT_EQ((*result).rate, expectedValue.at("rate").get<double>());
156156
EXPECT_EQ((*result).navigationHints, expectedValue.at("navigationHints").get<bool>());
157157
}
158158

@@ -164,7 +164,7 @@ TEST_F(AccessibilityTest, SubscribeOnVoiceGuidanceSettingsChanged)
164164
std::cout << "[Subscription] Accessibility voice guidance settings changed" << std::endl;
165165

166166
EXPECT_EQ(settings.enabled, true);
167-
EXPECT_EQ(settings.rate, 0.8f);
167+
EXPECT_EQ(settings.rate, 0.8);
168168
EXPECT_EQ(settings.navigationHints, true);
169169

170170
{

test/unit/accessibilityTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ TEST_F(AccessibilityTest, VoiceGuidanceSettings)
131131

132132
ASSERT_TRUE(result) << "AccessibilityImpl::voiceGuidanceSettings() returned an error";
133133
EXPECT_EQ((*result).enabled, expectedValue["enabled"].get<bool>());
134-
EXPECT_EQ((*result).rate, expectedValue["rate"].get<float>());
134+
EXPECT_EQ((*result).rate, expectedValue["rate"].get<double>());
135135
EXPECT_EQ((*result).navigationHints, expectedValue["navigationHints"].get<bool>());
136136
}
137137

test/unit/discoveryTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ TEST_F(DiscoveryTest, watched)
3131
{
3232
mock("Discovery.watched");
3333
std::string entityId = "content123";
34-
std::optional<float> progress = 0.75f;
34+
std::optional<double> progress = 0.75f;
3535
std::optional<bool> completed = true;
3636
std::optional<std::string> watchedOn = "2024-06-01T12:00:00Z";
3737
std::optional<Firebolt::Discovery::AgePolicy> agePolicy = Firebolt::Discovery::AgePolicy::ADULT;
@@ -60,7 +60,7 @@ TEST_F(DiscoveryTest, watched_payload)
6060
return Firebolt::Result<nlohmann::json>{res};
6161
}));
6262
std::string entityId = "content123";
63-
std::optional<float> progress = 0.75f;
63+
std::optional<double> progress = 0.75f;
6464
std::optional<bool> completed = true;
6565
std::optional<std::string> watchedOn = "2024-06-01T12:00:00Z";
6666
std::optional<Firebolt::Discovery::AgePolicy> agePolicy = Firebolt::Discovery::AgePolicy::ADULT;

0 commit comments

Comments
 (0)