tests: Add test for release_is_new()
Also refactor the function so we pass it the current version and don't rely on the define inside of it. This function only allows version format in the style of "x.y.z".
This commit is contained in:
@@ -471,11 +471,15 @@ release_get_latest(void)
|
||||
}
|
||||
|
||||
gboolean
|
||||
release_is_new(char* found_version)
|
||||
release_is_new(const char* const curr_version, const char* const found_version)
|
||||
{
|
||||
if (!curr_version || !found_version) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int curr_maj, curr_min, curr_patch, found_maj, found_min, found_patch;
|
||||
|
||||
int parse_curr = sscanf(PACKAGE_VERSION, "%d.%d.%d", &curr_maj, &curr_min,
|
||||
int parse_curr = sscanf(curr_version, "%d.%d.%d", &curr_maj, &curr_min,
|
||||
&curr_patch);
|
||||
int parse_found = sscanf(found_version, "%d.%d.%d", &found_maj, &found_min,
|
||||
&found_patch);
|
||||
|
||||
Reference in New Issue
Block a user