prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
_config.gpio_pin;
gpio_init_struct.GPIO_Mode = GPIO_Mode_IN;
gpio_init_struct.GPIO_Speed = GPIO_Speed_2MHz;
gpio_init_struct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(pin_config.gpio, &gpio_init_struct);
gpio_release(pin_config.gpio);
}
//! Configure bus pin as output
//! Lock bus and peripheral config access... | (BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_scl) | ;
bus_pin_cfg_input(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_sda);
}
}
//! Perform a soft reset of the bus
//! Always lock the bus before reset
static void bus_reset(uint8_t bus_idx) {
bus_disable(bus_idx);
bus_enable(bus_idx);
}
/*---------------INIT/USE/RELEASE/RESET FUNCTIONS----------------------*/
vo... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | {
uint8_t buffer[expected_attr_list_serialized_size];
const size_t size = attribute_list_serialize(attr_list_to_serialize, buffer,
buffer + expected_attr_list_serialized_size);
cl_assert_equal_i(size, expected_attr_list_serialized_size);
cl_assert_equal_m(expected_... |
void test_attribute__serialize_attr_list(void) {
AttributeList attr_list1 = {
.num_attributes = ARRAY_LENGTH(action1_attributes),
.attributes = action1_attributes
};
AttributeList attr_list2 = {
.num_attributes = ARRAY_LENGTH(action2_attributes),
.attributes = action2_attributes
};
Attri... |
t sensor_timestamp_before[3],
uint8_t sensor_timestamp_after[3]) {
uint32_t start_time = prv_sensortime_to_timestamp(sensor_timestamp_before);
uint32_t end_time = prv_sensortime_to_timestamp(sensor_timestamp_after);
uint32_t sample_time_bit = prv_get_sample_collection_bit();
// see if the upper bits ovef... | accel_cb_double_tap_detected(axis, direction) | ;
}
} else if (!anymotion) {
BMI160_DBG("Wahh, no motion/tap?: INT0: 0x%"PRIx8", INT2: 0x%"PRIx8, int0_status, int2_status);
prv_dump_int_stats();
}
if (toggled_power_mode) {
bmi160_set_accel_power_mode(BMI160_Accel_Mode_Low);
}
}
// TODO: strictly for debug, remove when done
static void prv_d... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | (stream, field) | ) {
return false;
}
const char *str = *(char **)arg;
return pb_encode_string(stream, (uint8_t *)str, strlen(str));
}
bool protobuf_log_util_encode_packed_varints(pb_ostream_t *stream, const pb_field_t *field,
void * const *arg) {
PLogPackedVarintsEncoderArg *enc... |
///////////
//! Helpers
static KinoReel* prv_get_icon_for_activity(ActivitySessionType type) {
switch (type) {
case ActivitySessionType_Open:
return kino_reel_create_with_resource(RESOURCE_ID_WORKOUT_APP_WORKOUT);
case ActivitySessionType_Walk:
return kino_reel_create_with_resource(RESOURCE_ID_WO... | (window, WINDOW_NAME("Workout Summary")) | ;
window_set_user_data(window, summary_window);
window_set_background_color(window, BACKGROUND_COLOR);
window_set_window_handlers(window, &(WindowHandlers){
.unload = prv_window_unload_handler,
});
GRect layer_bounds = window->layer.bounds;
layer_bounds.size.w -= ACTION_BAR_WIDTH;
layer_init(&summar... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | (!memory_layout_is_cstring_in_region(®ion, buffer, 10)) | ;
// Valid string
cl_assert(memory_layout_is_cstring_in_region(®ion, valid_str, 10));
// Max length is not long enough to find the null
cl_assert(!memory_layout_is_cstring_in_region(®ion, valid_str, 3));
// Invalid string, there is a null after the y's but the y's should be after the end of the region... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | window_init(&window, WINDOW_NAME("Health")) | ;
Layer *window_layer = window_get_root_layer(&window);
Layer *card_layer = health_hr_summary_card_create(health_data);
layer_set_frame(card_layer, &window_layer->bounds);
layer_add_child(window_layer, card_layer);
window_set_background_color(&window, health_hr_summary_card_get_bg_color(card_layer));
window... |
distance_m,
&bpm, &hr_zone));
cl_assert_equal_i(bpm, 0);
cl_assert_equal_i(hr_zone, HRZone_Zone0);
// Put a good quality reading. Verify it was accepted.
prv_put_bpm_event(100, HRMQuality_Good);
cl_assert(workout_service_get_current_workout_info(&steps, &d... | cl_assert_equal_b(s_hrm_subscribed, false) | ;
cl_assert_equal_i(s_hrm_expiration, 0);
}
// ---------------------------------------------------------------------------------------
// Open the app, start a workout, 120s, stop the workout, 120s, close app.
// Make sure the HR stays on for WORKOUT_ENDED_HR_SUBSCRIPTION_TS_EXPIRE - 120s
void test_workout_service__... |
RecognizerRef recognizer, void *context) {
AppWorkerResult result = app_worker_launch();
APP_LOG(APP_LOG_LEVEL_INFO, "launch result: %d", result);
}
static void select_click_handler(ClickRecognizerRef recognizer, void *context) {
AppWorkerMessage m;
app_worker_send_message('x', &m);
APP_LOG(APP_LOG_LEVEL_INF... | {
tick_timer_service_unsubscribe();
health_service_events_unsubscribe();
} |
void handle_init(void) {
window = window_create();
window_set_click_config_provider(window, click_config_provider);
window_stack_push(window, true /* Animated */);
window_set_background_color(window, GColorBlack);
Layer *window_layer = window_get_root_layer(window);
text_layer = text_layer_create(GRect... |
t_handler_entries(&s_stopped_handler_calls, a1), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a2), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a2), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a3), 1);
cl_assert_equal_i(prv_... | {
#ifdef TEST_INCLUDE_COMPLEX
const int duration_a = 300;
const int delay_a = 100;
const int duration_b = 500;
const int delay_b = 200;
const int delay_seq = 150;
int duration_total = duration_a + duration_b + delay_a + delay_b + delay_seq;
// Create 2 test animations
Animation *a = prv_create_test_an... |
cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0);
// Start A after delay
prv_advance_to_ms_with_timers(start_ms + delay_seq + delay_a + 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_... |
le waiting to send.
// The CommSession has already been closed so simply return without doing
// anything further.
break;
}
}
}
static void prv_reset(Transport *transport) {
PBL_LOG(LOG_LEVEL_INFO, "Unimplemented");
}
static void prv_granted_kernel_main_cb(void *ctx) {
ResponsivenessGrante... | (resp, &cb_data->packet, cb_data->packet_length) | ;
pulse_reliable_send(resp, cb_data->packet_length);
kernel_free(data);
}
static void prv_pulse_pp_send(uint8_t opcode, uint8_t *data, size_t data_length) {
size_t packet_length = sizeof(PulsePPCallbackPacket) + data_length;
PulsePPCallbackPacket *cb_data = kernel_malloc_check(packet_length);
cb_data->packet... |
but different RGB values are not considered equal
GColor8 color1 = GColorBlue;
color1.a = 0;
GColor8 color2 = GColorRed;
color2.a = 0;
cl_assert(!gcolor_equal__deprecated(color1, color2));
}
void test_graphics_colors__inverted_readable_color(void) {
GColor8 (*fun)(GColor8) = gcolor_legible_over;
// tran... | (GColorBlue, 1) | ;
}
void test_graphics_colors__tint_luminance_lookup_table_init(void) {
GColor8 tint_color = GColorClear;
GColor8 lookup_table_out[GCOLOR8_COMPONENT_NUM_VALUES];
// Passing in NULL for lookup_table_out should assert
cl_assert_passert(gcolor_tint_luminance_lookup_table_init(tint_color, NULL));
// Setting th... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | graphics_draw_pixel(ctx, GPoint(layer->bounds.size.w - offset - 1,
layer->bounds.size.h - mask - 1)) | ;
}
}
static void prv_draw_border(Layer *layer, GContext *ctx, uint8_t radial_padding_size) {
if (radial_padding_size != 0) {
prv_draw_round_border(layer, ctx, 0);
}
prv_draw_round_border(layer, ctx, radial_padding_size);
// Draw letter to identify screen
if (radial_padding_size >= 2) {
GRect iden... |
s_2015_nov12_123456_gmt = 1447331696;
// Saturday 2015 Dec 19, 12:34:56 GMT
static const time_t s_2015_dec19_123456_gmt = 1450528496;
// DST points
static const time_t s_2015_nov20_020000_gmt = 1447984800;
static const time_t s_2015_dec20_020000_gmt = 1450576800;
static const TimezoneInfo s_timezone_gmt = {
.tm_zon... | {
CronJob test_cron = {
.cb = prv_cron_callback,
.cb_data = (void*)0,
.minute = 35,
.hour = CRON_HOUR_ANY,
.mday = CRON_MDAY_ANY,
.month = CRON_MONTH_ANY,
.may_be_instant = true,
.clock_change_tolerance = 0,
};
CronJob *job = &test_cron;
time_t base = s_2015_nov12_123456_gmt;
... |
static void prv_basic_test(const TimezoneInfo *tz_info, CronJob *job, time_t base,
time_t offset, time_t increment, int dst_type) {
TimezoneInfo new_tz_info = *tz_info;
switch (dst_type) {
case 0:
break;
case 1:
new_tz_info.dst_start = s_2015_nov20_020000_gmt;
... |
{
activity_private_settings_close(file);
} |
}
mutex_unlock_recursive(s_activity_state.mutex);
}
// ------------------------------------------------------------------------------------------------
// Tail end of prv_process_minute_data, separated out to decrease stack requirements. This
// portion of the logic handles activity process, saving prefs to our ... | |
/*
* Copyright 2024 Google LLC
*
* 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 i... | PBL_LOG_COLOR(LOG_LEVEL_INFO, BATT_LOG_COLOR, "Battery good: resume normal operation") | ;
}
static void prv_exit_critical(void) {
// Checking the state here is a bit of a hack because the state machine does not have proper
// transition actions, only entry/exit actions.
// We check that the state is PowerStateGood because the state machine does not transition through
// all states in between the ... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | cl_assert_equal_p(&some_addr + 0 * 123, gbitmap_get_data_row_info(&bmp, 0).data) | ;
cl_assert_equal_p(&some_addr + 1 * 123, gbitmap_get_data_row_info(&bmp, 1).data);
cl_assert_equal_i(0, gbitmap_get_data_row_info(&bmp, 3).min_x);
cl_assert_equal_i(3, gbitmap_get_data_row_info(&bmp, 3).max_x);
}
void test_gbitmap_data_row_info__get_info_circular(void) {
uint8_t some_addr;
GBitmapDataRowInf... |
break;
case OP_MOVE_P2_X:
data->p2.x++;
break;
case OP_MOVE_P2_Y:
data->p2.y++;
break;
default:
PBL_LOG(LOG_LEVEL_ERROR, "Invalid operation type: %d", data->operation);
break;
}
layer_mark_dirty(data->canvas_layer);
PBL_LOG(LOG_LEVEL_DEBUG, "line(p1(%d, %d), p2(%d... | graphics_draw_line(ctx, p2, p3) | ;
return;
}
if (data->operation == OP_TEST3) {
int x1 = 50,
x2 = 100,
y1 = 40,
y2 = 120;
GPoint p0 = GPoint(x1, y1);
GPoint p1 = GPoint(x1, y2);
GPoint p2 = GPoint(x2, y2);
GPoint p3 = GPoint(x2, y1);
// graphics_context_set_stroke_color(ctx, GColorWhite);
graphics_co... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | list_contains(list, &handler->list_node) | ) {
PBL_LOG(LOG_LEVEL_DEBUG, "Event service handler not subscribed");
return;
}
sys_event_service_client_unsubscribe(state, handler);
}
void event_service_client_handle_event(PebbleEvent *e) {
EventServiceInfo *state = prv_get_state();
const uintptr_t type = e->type;
// find the first callback
List... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | cl_assert(num.integer == -1) | ;
cl_assert(num.fraction == 3);
test_num = (int32_t)((float)-0.500 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_value = test_num };
cl_assert(num.integer == -1);
cl_assert(num.fraction == 4);
test_num = (int32_t)((float)-0.375 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_valu... |
464, 768, 232},
{ -448, 744, 224},
{ -424, 744, 208},
{ -440, 736, 224},
{ -448, 744, 224},
{ -448, 744, 224},
{ -440, 736, 224},
// 179 seconds
{ -448, 760, 224},
{ -440, 736, 208},
{ -448, 736, 216},
{ -440, 744, 216},
{ -440, 736, 208},
{ -456, 736, 216},
{ -44... | { -424, 760, 200},
{ -432, 752, 200},
{ -440, 752, 200},
{ -432, 752, 200},
{ -432, 752, 200},
{ -440, 760, 192},
{ -432, 752, 200},
{ -432, 752, 200},
{ -432, 760, 192},
{ -440, 752, 184},
{ -440, 752, 192},
{ -440, 760, 192},
{ -424, 688, 248},
{ -456, 808, 208}... | |
ture_LEDCurrent)) {
continue;
}
break;
case HRMEvent_HRV:
if (!(state->features & HRMFeature_HRV)) {
continue;
}
break;
case HRMEvent_Diagnostics:
if (!(state->features & HRMFeature_Diagnostics)) {
continue;
}
brea... | HRM_LOG("LED %"PRIu16"uA, TIA: %"PRIu16, data->led_current_ua, data->tia) | ;
time_t utc_now = rtc_get_time();
RtcTicks cur_ticks = rtc_get_ticks();
HRMFeature kernel_bg_features_sent = 0;
HRMSubscriberState *state = (HRMSubscriberState *)s_manager_state.subscribers;
while (state) {
HRMSubscriberState *expired_state = NULL;
// Update the time stamp for when this subscriber... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | {
return NULL;
} |
// The first 4 bytes for media data files contains the type signature (except legacy PBI)
uint32_t data_signature;
if (sys_resource_load_range(app_num, resource_id, 0, (uint8_t*)&data_signature,
sizeof(data_signature)) != sizeof(data_signature)) {
return NULL;
}
switch (ntohl(data_signature)) {... |
_window, windows[3][0]);
// Add priority 3 transparent window 1
window_set_transparent(windows[3][1], true);
window_stack_push(window_stacks[3], windows[3][1], false);
// A transparent window is now the top window, and there is another transparent window below
// Test: Multiple transparent top windows resul... | cl_assert_equal_i(windows[2][0]->on_screen, false) | ;
cl_assert_equal_i(windows[2][0]->is_click_configured, false);
cl_assert_equal_p(s_last_click_configured_window, windows[2][0]);
// Add priority 3 opaque window 0
cl_assert(NumModalPriorities > 3);
window_stack_push(window_stacks[3], windows[3][0], false);
// An opaque top window of a different stack is ... |
*data) {
int fd = prv_pmap_open_debug_wrapper(s_map_filename, OP_FLAG_READ, 0, 0);
if (fd < 0) {
PBL_LOG(LOG_LEVEL_WARNING, "pmap search (open) failed: %d", fd);
return (fd);
}
int seek_result = seek_map(fd, callback, data);
pfs_close(fd);
return (seek_result);
}
static bool walk_max_used_id(Pers... | (search_result) | ;
}
return field.id;
}
int persist_map_auto_id(const Uuid *uuid) {
int id = persist_map_get_id(uuid);
if (PASSED(id)) {
return id;
}
if (id != E_DOES_NOT_EXIST) {
RETURN_STATUS_UP(id);
}
return persist_map_add_uuid(uuid);
}
static bool walk_get_uuid(PersistMapIdField *field, void *data) {
... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | if (fd < 0) { // pmap, where'd you go, we miss you so?!
PBL_HEXDUMP_D(LOG_LEVEL_INFO, LOG_LEVEL_INFO, (uint8_t *)s_pmap_fd_diagnostic_data,
sizeof(s_pmap_fd_diagnostic_data));
test_infra_quarantine_board("pmap file went missing");
} else {
prv_pmap_grab_debug_fd_data(fd);
} |
#endif /* IS_BIGBOARD */
return fd;
}
static int seek_map(int fd, SearchCallback callback, void *data) {
pfs_seek(fd, sizeof(PersistMapHeader), FSeekSet);
bool found = false;
PersistMapIdField field;
while (true) {
int read_result = pfs_read(fd, (uint8_t *)&field, sizeof(field));
// short read, E... |
0, -160},
{ 592, 184, -136},
{ 496, 208, -144},
{ 520, 112, -120},
{ 672, 208, -128},
{ 936, 248, -176},
{ 1176, 264, -208},
{ 1104, 280, -256},
{ 1056, 264, -264},
{ 1280, 288, -224},
{ 1096, 288, -184},
{ 952, 240, -104},
{ 1104, 264, -120},
{ 1184, 280, -64},
{... | { 1400, 96, -8},
{ 1256, 96, 8},
{ 1072, 80, -80},
{ 1200, 136, -72},
{ 1232, 136, -56},
{ 1048, 216, -112},
{ 736, 176, -152},
// 81 seconds
{ 536, 184, -136},
{ 464, 144, -136},
{ 512, 176, -80},
{ 624, 216, -88},
{ 824, 256, -128},
{ 1176, 312, -256},
{ 111... |
{ 544, 280, -80},
{ 560, 224, -72},
{ 696, 200, -112},
{ 816, 256, -208},
{ 1000, 256, -240},
{ 1104, 272, -296},
{ 1064, 280, -264},
{ 1288, 288, -200},
{ 1176, 336, -208},
{ 1024, 288, -136},
{ 1208, 272, -72},
{ 1216, 248, 0},
{ 1120, 256, -24},
{ 896, 200, -3... |
->in.scope);
cl_assert_equal_i(accessible, tests[i].out.accessible);
}
}
void test_health__sleep_session_matches(void) {
const time_t now = rtc_get_time();
ActivitySession session = {
.type = ActivitySessionType_Sleep,
.start_utc = now - (10 * SECONDS_PER_MINUTE),
.length_min = 10,
};
bool (*... | {
const time_t now = rtc_get_time();
// start from oldest to most-recent - this is more or less an arbitrary order
s_sys_activity_get_sessions_values.out.sessions[6] = (ActivitySession){
.type = ActivitySessionType_Open,
.start_utc = now - (95 * SECONDS_PER_MINUTE),
.length_min = 15, // end = -80
}... |
// oldest to most-recent (looking at each session's start): 3, 2, 1, 0
// most-recent to oldest (looking at each session's end): 1, 0, 3, 2
const int num_sleep_sessions = 4;
const int num_restfulsleep_sessions = 2;
const int num_run_sessions = 1;
const int num_walk_sessions = 1;
const int num_open_sessi... |
ntentSizeSmall] = {
.layer_width = 14,
.crumb_radius = 2,
.crumb_spacing = 8,
.crumb_space_from_top = 8,
},
[PreferredContentSizeMedium] = {
.layer_width = 14,
.crumb_radius = 2,
.crumb_spacing = 8,
.crumb_space_from_top = 8,
},
[PreferredContentSizeLarge] = {
.layer_width = ... | crumbs_layer_init(cl, &frame, fg_color, bg_color) | ;
}
return cl;
}
void crumbs_layer_deinit(CrumbsLayer *crumbs_layer) {
if (crumbs_layer == NULL) {
return;
}
layer_deinit((Layer *)crumbs_layer);
}
void crumbs_layer_destroy(CrumbsLayer *crumbs_layer) {
crumbs_layer_deinit(crumbs_layer);
applib_free(crumbs_layer);
}
int16_t prv_x_getter(void *sub... |
{
graphics_context_set_stroke_width(&ctx, stroke_width);
graphics_draw_arc_internal(&ctx, pt, radius, 0, test_angles[i].angle);
stroke_width += 1;
radius += 3;
pt.x += (radius + stroke_width) * 2;
if (pt.x > 120) {
pt.x = CENTER_OF_ORIGIN_RECT.x;
pt.y += (radius + st... |
char filename[100];
snprintf(filename, sizeof(filename),
"draw_arc_offset_aa_end_angle_%s.${BIT_DEPTH_NAME}.pbi", test_angles[i].filename_part);
cl_check_(gbitmap_pbi_eq(&ctx.dest_bitmap, filename), filename);
}
for (int i = 0; i < ARRAY_LENGTH(test_angles); i++) {
setup_test_aa_sw(&... | |
RANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "applib/graphics/graphics.h"
#include "applib/graphics/framebuffer.h"
#include "applib/ui/window_private.h"
#include "applib/ui/layer.h"
... | test_graphics_context_init(&ctx, fb) | ;
layer_init(&layer, &GRect(10, 10, 60, 60));
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_line_inside_offset_layer")));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | (&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start) | ;
// Tests
cl_assert(word_iter_state.current.start == word_iter_state.current.end);
cl_assert(!iter_next(&word_iter));
cl_assert(word_iter_state.current.width_px == 0);
}
void test_word_iterator__test_unprintable(void) {
// Allocate mutable types
Iterator word_iter = (Iterator) { 0 };
WordIterState word... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | (REBOOT_REASON_DROPPED_EVENT, raw[5]) | ;
}
void reboot_reason_set_restarted_safely(void) {
RebootReason reason;
reboot_reason_get(&reason);
reason.restarted_safely = true;
uint32_t* raw = (uint32_t *)&reason;
RTC_WriteBackupRegister(REBOOT_REASON_REGISTER_1, *raw);
}
void reboot_reason_get(RebootReason *reason) {
uint32_t *raw = (uint32_t *)r... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | i18n_noop("5 Seconds") | ,
i18n_noop("8 Seconds")
};
static int prv_timeout_get_selection_index() {
uint32_t timeout_ms = backlight_get_timeout_ms();
for (size_t i = 0; i < ARRAY_LENGTH(s_timeout_values); i++) {
if (s_timeout_values[i] == timeout_ms) {
return i;
}
}
return 0;
}
static void prv_timeout_menu_select(Opti... |
data */);
PropertyAnimation *a_rev = property_animation_clone(a);
animation_set_handlers((Animation*) a_rev, (AnimationHandlers) {
.started = (AnimationStartedHandler) animation_started,
.stopped = (AnimationStoppedHandler) animation_stopped,
}, NULL /* callback data */);
animation_set_delay((Animatio... | (s_animation) | ;
window_stack_remove(window, false);
window_destroy(window);
text_layer_destroy(s_text_layer_a);
}
int main(void) {
init();
app_event_loop();
deinit();
}
|
leTask task, void (*callback)(void *data),
void *data) {
callback(data);
}
void accessory_imaging_enable(bool enable) {
}
// Tests
///////////////////////////////////////////////////////////////////////////////
static GettingStartedButtonComboState s_state;
stat... | stub_new_timer_timeout(timer->id) | |
tmap_pbi_eq(bitmap, GET_PBI_NAME(3)));
// Frame 3 has delay 1000 ms, frame 4 and 5 have zero delay, so at time 2000 ms == frame 5
gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 2 * 1000);
cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5)));
// Since loop only equals 1, make sure that huge el... | gbitmap_set_bounds(bitmap, orig_bounds) | ;
cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5)));
#endif
}
// Tests APNG file with 8-bit color, originally broke the updated upng+tinflate code
// Result:
// - gbitmaps matches platform decoded APNG
void test_gbitmap_sequence__color_8bit_yoshi(void) {
#if PLATFORM_SPALDING
bool status = false;
uint32_t reso... |
tribtue from the notification and add:
// - Timestamp attribute
const int num_extra_attributes = 1;
const int num_attributes = pin->attr_list.num_attributes + num_extra_attributes;
AttributeList response_attributes = (AttributeList) {
.num_attributes = num_attributes,
.attribute... | timeline_invoke_action(item, dismiss_action, NULL) | ;
}
SimpleDialog *stopped_sharing_dialog = ble_hrm_stop_sharing_popup_create();
action_menu_set_result_window(action_menu, &stopped_sharing_dialog->dialog.window);
}
#endif
T_STATIC ActionResultData *prv_invoke_action(ActionMenu *action_menu,
const TimelineItemAction... |
= {
.init = reminder_db_init,
.insert = reminder_db_insert,
.get_len = reminder_db_get_len,
.read = reminder_db_read,
.del = reminder_db_delete,
.flush = reminder_db_flush,
.is_dirty = reminder_db_is_dirty,
.get_dirty_list = reminder_db_get_dirty_list,
.mark_synced = reminder_db_mark... | if (rv == S_SUCCESS) {
blob_db_event_put(BlobDBEventTypeInsert, db_id, key, key_len);
} |
return rv;
}
return E_INVALID_OPERATION;
}
int blob_db_get_len(BlobDBId db_id,
const uint8_t *key, int key_len) {
if (!prv_db_valid(db_id)) {
return E_RANGE;
}
const BlobDB *db = &s_blob_dbs[db_id];
if (db->get_len) {
return db->get_len(key, key_len);
}
return E_INVALID_OPERATION;
... |
ache 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 dis... | (pattern_attribute) | ;
for (unsigned int i = 0; i < prv_vibe_score_get_pattern_length(pattern_attribute); i++) {
if (pattern_list[i] >= num_note_types) {
return false;
}
}
GenericAttribute *repeat_delay_attribute =
generic_attribute_find_attribute(&score->attr_list, VibeAttributeId_RepeatDelay,
... |
dow, ClickConfigProvider click_config_provider, void *context) {}
void window_set_click_context(ButtonId button_id, void *context) {}
void window_single_repeating_click_subscribe(
ButtonId button_id, uint16_t repeat_interval_ms, ClickHandler handler) {}
// Internal definitions
////////////////////////////////////
... | GSize(180, 2000) | );
scroll_layer_scroll(scroll_layer, ScrollDirectionDown, false);
// scroll offset for scroll down is negative, so invert offset.y
cl_assert_equal_i(page_height, -((int32_t)scroll_layer_get_content_offset(scroll_layer).y));
}
void test_scroll_layer__paging_last_pages_content(void) {
uint16_t page_height = 86;
... |
L_2_REG = 0x882d;
DCDC->DCDC_V14_0_REG = 0xa1a4;
DCDC->DCDC_V14_1_REG = 0xd890;
DCDC->DCDC_V18_0_REG = 0xe3e4;
DCDC->DCDC_V18_1_REG = 0xbc90;
DCDC->DCDC_VDD_0_REG = 0xc304;
DCDC->DCDC_VDD_1_REG = 0xec90;
DCDC->DCDC_V18P_0_REG = 0xe3e4;
DCDC->DCDC_V18P_1_REG = 0xbc90;
DCDC->DCDC_RET_0_REG = 0xaaa6;
D... | (DCDC, DCDC_VDD_1_REG, DCDC_VDD_IDLE_HYST, 0x4) | |
dls_log(dls_session, &record, 1) | ;
bool success = (result == DATA_LOGGING_SUCCESS);
// Force data logging to send to the phone
if (success) {
dls_send_all_sessions();
}
return success;
}
| |
a sequence out of a and b
Animation *a = prv_create_test_animation();
Animation *b = prv_create_test_animation();
Animation *seq = animation_sequence_create(a, b, NULL);
cl_assert(seq != NULL);
// Try to create a spawn out of b and c
Animation *c = prv_create_test_animation();
Animation *spawn = animatio... | (animation_get_elapsed(h, &elapsed_ms)) | ;
cl_assert_equal_i(elapsed_ms, 0);
cl_must_pass(animation_get_progress(h, &progress));
cl_assert_equal_i(progress, 0);
animation_set_elapsed(h, duration / 2);
cl_must_pass(animation_get_elapsed(h, &elapsed_ms));
cl_assert_equal_i(elapsed_ms, duration / 2);
cl_must_pass(animation_get_progress(h, &progress... |
tatic int s_health_app_opened_version = 0;
uint8_t activity_prefs_get_health_app_opened_version(void) {
return s_health_app_opened_version;
}
ActivityScalarStore activity_metrics_prv_steps_per_minute(void) {
return s_data.steps_per_minute;
}
// ===================================================================... | prv_calculate_metric_history_stats(ActivityMetricStepCount, &stats) | ;
cl_assert_equal_i(stats.median, 4277);
cl_assert_equal_i(stats.total_days, 16);
cl_assert_equal_i(stats.consecutive_days, 3);
}
// ---------------------------------------------------------------------------------------
// Test that the sleep reward triggers when it should, and doesn't trigger when it shouldn't... |
"aaaa aaaa aaaa aaaa " // 20- 40
"aaaa aaaa aaaa aaaa " // 40- 60
"aaaa aaaa aaaa aaaa " // 60- 80
"aaaa aaaa aaaa aaaa " // 80-100
"aaaa aaaa aaaa aaaa " //100-120
"aaaa aaaa aaaa aaaa... | (zntest[1], 0) | ;
tntest[0] = tntest[1] = 0;
snprintf(dstbuf, 512, "aaaa aaaa aaaa aaaa " // 0- 20
"aaaa aaaa aaaa aaaa " // 20- 40
"aaaa aaaa aaaa aaaa " // 40- 60
"aaaa aaaa aaaa aaaa " // 60- 80
"aaaa aaaa aaaa aaaa " // 80-100
... |
(scroll_layer,
(GSize) { scroll_layer->layer.frame.size.w, new_height });
scroll_layer_set_content_offset(scroll_layer, offset, true /* animated */);
animation_set_duration(property_animation_get_animation(scroll_layer->animation),
SCROLL_ANIMATION_DURATION);
}
lay... | (POP_WINDOW_DELAY,
prv_transcription_dialog_select_cb, transcription_dialog) | |
t(void) {
if (!s_vibe_history_enabled) {
return;
}
VibeHistory *vibe = kernel_malloc(sizeof(VibeHistory));
if (vibe == NULL) {
s_vibe_history_enabled = false;
return;
}
list_init((ListNode*)vibe);
time_t s;
uint16_t ms;
rtc_get_time_ms(&s, &ms);
vibe->time_start = ((uint64_t)s) * 1000 + ... | (VIBE_STRENGTH_OFF) | ;
s_pattern_in_progress = false;
}
mutex_unlock(s_vibe_pattern_mutex);
}
int32_t vibes_get_vibe_strength(void) {
return s_vibe_strength;
}
int32_t vibes_get_default_vibe_strength(void) {
return s_vibe_strength_default;
}
void vibes_set_default_vibe_strength(int32_t vibe_strength_default) {
s_vibe_stre... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | (sizeof(Write)) | ;
uint8_t *buffer;
if (value_length) {
cl_assert(value);
buffer = malloc(value_length);
memcpy(buffer, value, value_length);
} else {
cl_assert_equal_p(value, NULL);
buffer = NULL;
}
*write = (const Write) {
.characteristic = characteristic,
.client = client,
.is_response_requi... |
vented_timer.h"
#include "services/common/i18n/i18n.h"
#include "services/normal/blob_db/reminder_db.h"
#include "services/normal/bluetooth/ble_hrm.h"
#include "services/normal/notifications/action_chaining_window.h"
#include "services/normal/notifications/alerts_preferences.h"
#include "services/normal/notifications/a... | if (data->voice_data) {
prv_cleanup_voice_data(data->voice_data);
data->voice_data = NULL;
} |
if (data->chaining_data.notif) {
timeline_item_destroy(data->chaining_data.notif);
data->chaining_data.notif = NULL;
}
if (data->progress_window) {
progress_window_destroy(data->progress_window);
data->progress_window = NULL;
}
applib_free(data->dialog.message);
data->dialog.message = NU... |
to clean up the application's data before exiting
static void prv_cancel_fake_progress_timer(ProgressWindow *data) {
if (data->fake_progress_timer != EVENTED_TIMER_INVALID_ID) {
evented_timer_cancel(data->fake_progress_timer);
data->fake_progress_timer = EVENTED_TIMER_INVALID_ID;
}
}
static void prv_set_pr... | {
// Create and set up the window
Window *window = &data->window;
window_init(window, WINDOW_NAME("Progress Window"));
window_set_background_color(window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite));
const GRect *bounds = &window->layer.bounds;
GPoint center = grect_center_point(bounds);
const GRect... | |
66, true,
"1 hr 1 min 6 sec",
1,
},
{ "'%auT')", 3666, true,
"1 hour, 1 minute, and 6 seconds",
1,
},
{ "'%0uT')", 3666, true,
"01 hour, 01 minute, and 06 seconds",
1,
},
{ "'%fT')", 129666, true,
"36:01:06",
1,
},
{ "'%T')", 129666, true,
"12:01:06",
1,
},
/... | cl_assert_equal_i(s_cond.eval_time, test->expect_eval_time);
#if DEBUG_PRINTING
printf("\n");
#endif
} |
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Test pipeline parser
static const struct {
const char *instr;
time_t intime;
const char *expect_str;
time_t expect_time;
bool expect_rv;
TemplateStringErrorStatus expect_status;
size_t expect_index... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | layer_get_global_frame(container, page_rect_on_screen) | ;
if (container == &text_layer->layer) {
page_rect_on_screen->size.h = TEXT_LAYER_FLOW_DEFAULT_PAGING_HEIGHT;
}
}
return true;
}
|
_WARNING, "Mobile app calling deprecated API, time = %d",
(int)new_time);
if (clock_is_timezone_set()) {
new_time = prv_migrate_local_time_to_UTC(new_time);
}
prv_update_time_info_and_generate_event(&new_time, NULL);
}
void clock_protocol_msg_callback(CommSession *session, const uint8_t* data, uns... | (format, buffer) | ;
return ret_val;
}
size_t clock_get_time_number(char *number_buffer, size_t number_buffer_size, time_t timestamp) {
const size_t written =
prv_format_time(number_buffer, number_buffer_size,
(clock_is_24h_style() ? i18n_noop("%R") : i18n_noop("%l:%M")), timestamp);
const char *number_... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | {
return prv_heap_malloc(bytes);
} |
void *kernel_zalloc(size_t bytes) {
void *ptr = prv_heap_malloc(bytes);
if (ptr) {
memset(ptr, 0, bytes);
}
return ptr;
}
void *kernel_malloc_check(size_t bytes) {
void *ptr = prv_heap_malloc(bytes);
PBL_ASSERTN(ptr);
return ptr;
}
void *kernel_zalloc_check(size_t bytes) {
void *ptr = prv_heap_m... |
torage_get(app_id);
if (app_name) {
prv_put_ancs_message(&app_name);
prv_reset_and_next();
} else {
prv_get_app_attributes(app_id);
}
}
// -----------------------------------------------------------------------------
// GATT Characteristic update & subscribe
static ANCSCharacteristic prv_get_id_for_... | {
return false;
} |
for (int c = 0; c < NumANCSCharacteristic; ++c) {
if (s_ancs_client->characteristics[c] == characteristic) {
return true;
}
}
return false;
}
// -------------------------------------------------------------------------------------------------
// Handling inbound GATT Notifications
static void prv... |
6, -56},
// 68 seconds
{ 2608, 2712, -1808},
{ 1856, 3688, -2480},
{ 320, 2248, -1888},
{ -600, 1296, -1160},
{ -592, 840, -760},
{ -928, 120, 32},
{ -1528, -40, 96},
{ -1368, 192, -144},
{ -1072, 656, -200},
{ -1104, 2416, -1736},
{ -160, 3328, -2240},
{ 1352, 2320, ... | { 1440, -624, 224},
{ 928, -280, 184},
{ 1152, 408, -368},
{ 1840, 2240, -1608},
{ 1664, 3112, -2400},
{ 896, 2616, -2072},
{ -56, 1480, -1160},
{ -248, 792, -616},
{ -872, 232, -216},
{ -1736, 0, -144},
{ -1432, 104, -160},
{ -1304, 824, -304},
{ -792, 2088, -1000},
... |
{ -752, 384, -848},
{ -1112, -128, -296},
{ -1576, -72, -152},
{ -1024, -24, -136},
{ -1176, 440, -120},
{ -904, 1960, -1184},
{ -368, 4000, -2080},
{ 1040, 3304, -2048},
// 76 seconds
{ 856, 2040, -856},
{ 1152, 664, -120},
{ 1624, -584, -104},
{ 1576, -1104, 368},
... |
FONT_KEY_LECO_28_LIGHT_NUMBERS);
const char * const font_key_accent_numbers = PBL_IF_ROUND_ELSE(FONT_KEY_LECO_20_BOLD_NUMBERS,
FONT_KEY_LECO_38_BOLD_NUMBERS);
// hole, par numbers
const ... | (text[TextBack]) | );
// Mid value.
text[TextMid] = text_layer_create(GRect(distance_column_x_offset, mid_value_y_offset,
distance_column_width, accent_numbers_height));
prv_setup_text_layer(text[TextMid], font_key_accent_numbers, NULL, distance_text_alignment);
layer_add_child(backgroun... |
sizeof(val), "v%03d", i);
printf("Iteration %d key %s val %s\n", i, key, val);
set_and_verify(&file, key, key_len, val, val_len);
// delete the first 50
if (i < 50) {
settings_file_delete(&file, key, key_len);
}
}
prv_print_stats(&file);
settings_file_compact(&file);
const SettingsFile... | ((char *)key, sizeof(key), "k%03d", 128) | ;
for (int i = 0; i < 128; i++) {
snprintf((char *)val, sizeof(val), "v%03d", i);
printf("Iteration %d val %s\n", i, val);
set_and_verify(&file, key, key_len, val, val_len);
}
// Finally, try to set a key to a large value. This should succeed with
// plenty of room to spare if our space tracking is... |
6, 1232, -552},
{ 1080, 912, -392},
{ 1112, 704, -288},
// 23 seconds
{ 1264, 608, -264},
{ 1464, 664, -232},
{ 1392, 416, -144},
{ 1312, 160, -168},
{ 1208, 288, -120},
{ 1304, 288, -96},
{ 1408, 200, -136},
{ 1288, 192, -56},
{ 1128, 120, -104},
{ 608, -240, -16},
... | { 1304, 216, -248},
{ 824, -168, -176},
{ 304, -560, -208},
{ 768, -432, -304},
{ 1392, -400, -288},
{ 1832, -8, -376},
{ 1672, 32, -472},
{ 1456, 360, -544},
{ 1416, 544, -496},
{ 1376, 768, -472},
{ 1504, 568, -264},
{ 1552, 672, -208},
{ 1080, 752, -160},
{ 848... |
{ 1184, 1248, -392},
{ 1144, 816, -320},
// 31 seconds
{ 1056, 752, -360},
{ 1200, 568, -304},
{ 1352, 432, -272},
{ 1336, 448, -208},
{ 1344, -56, -120},
{ 1288, 320, -160},
{ 1288, 144, -224},
{ 1232, 184, -176},
{ 1064, 168, -224},
{ 1072, -56, -128},
{ 592, -... |
ic == SprfMagic_ValidEntry || page_magic == SprfMagic_UnpopulatedEntry) {
flash_read_bytes((uint8_t *) &data, SPRF_PAGE_FLASH_ADDR(i), sizeof(data));
if (prv_valid_struct(&data)) {
s_valid_page_idx = i;
break;
}
}
}
// Keep a write offset, this won't work when ... | if (flags) {
*flags = data.flags;
} |
if (name_out) {
SprfBlePairingName name_data = {};
const bool name_rv = SPRF_FETCH_FIELD(name_data, ble_pairing_name);
// Should we return a failure on a failed name get?
if (name_rv) {
strncpy(name_out, name_data.name, BT_DEVICE_NAME_BUFFER_SIZE);
} else {
name_out[0... |
l_data(AccelDriverSample *data) {
uint8_t raw_buf[BMA255_FIFO_FRAME_SIZE_BYTES];
bma255_burst_read(BMA255Register_ACCD_X_LSB, raw_buf, sizeof(raw_buf));
prv_convert_accel_raw_data_to_mgs(raw_buf, data);
// FIXME: assuming the timestamp on the samples is NOW! PBL-33765
data->timestamp_us = prv_get_curr_system... | accel_cb_shake_detected(axis, direction) | ;
}
}
// Services tap/motion interrupts
static void prv_bma255_IRQ1_handler(bool *should_context_switch) {
BMA255_DBG("Slope Int");
if (!s_accel_outstanding_motion_work) {
s_accel_outstanding_motion_work = true;
accel_offload_work_from_isr(prv_handle_motion_interrupts, should_context_switch);
}
}
// S... |
i18n_get("Snooze Delay", data) | ,
.is_leaf = 0,
.next_level = prv_create_snooze_menu(main_menu),
};
main_menu->separator_index = DetailMenuItemIndexSnooze;
data->menu_config.root_level = main_menu;
// Setup snooze menu items
ActionMenuLevel *snooze_level = main_menu->items[DetailMenuItemIndexSnooze].next_level;
static const unsig... | |
er that needs to be free'd with
// app_install_release_md if we don't actually proceed with launching the app.
const PebbleProcessMd *app_md = config->md;
const AppInstallId new_app_id = app_install_get_id_for_uuid(&app_md->uuid);
if (!config->restart && uuid_equal(&(app_md->uuid), &(s_app_task_context.app_md... | process_manager_launch_process(&(ProcessLaunchConfig) {
.id = destination_app_id,
.common.transition = shell_get_close_compositor_animation(current_app_id, destination_app_id),
.forcefully = !gracefully,
}) | ;
}
// -----------------------------------------------------------------------------------------
void app_manager_set_minimum_run_level(ProcessAppRunLevel run_level) {
s_minimum_run_level = run_level;
}
// -----------------------------------------------------------------------------------------
void app_manager_for... |
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 Li... | gpath_create(&s_duplicates_path_info) | ;
s_crossing_path = gpath_create(&s_crossing_path_info);
s_infinite_path = gpath_create(&s_infinite_path_info);
s_aa_clipping_path = gpath_create(&s_aa_clipping_path_info);
prv_reset();
}
void test_graphics_gpath_${BIT_DEPTH_NAME}__cleanup(void) {
free(fb);
gpath_destroy(s_house_path);
gpath_destroy(s_bo... |
d_messages(void) {
uint8_t max_batched_ops = prv_put_bytes_get_max_batched_pb_ops();
int num_ops = 500;
if (max_batched_ops < 2) { // This race condition is not possible if we aren't pre-Acking
return;
}
prv_receive_init(VALID_OBJECT_SIZE * num_ops, ObjectFirmware);
fake_comm_session_process_send_next... | prv_receive_abort(~s_last_response_cookie) | ;
assert_ack_count(0);
assert_nack_count(1);
}
void test_put_bytes__abort_message_ok(void) {
prv_receive_init_and_put_fw_object();
prv_process_and_reset_test_counters();
prv_receive_abort(s_last_response_cookie);
assert_ack_count(1);
assert_nack_count(0);
assert_cleanup_event(ObjectFirmware, VALID_O... |
d_string);
ANALYTICS_LOG_DEBUG("App Crash event: uuid:%s, pc: %p, lr: %p",
uuid_string, (void *)pc, (void *)lr);
#endif
analytics_logging_log_event(&event_blob);
}
extern bool comm_session_is_valid(const CommSession *session);
// -------------------------------------------------------------... | analytics_logging_log_event(&event_blob) | ;
}
// ------------------------------------------------------------------------------------------
void analytics_event_PPoGATT_disconnect(time_t timestamp, bool successful_reconnect) {
AnalyticsEventBlob event_blob = {
.event = AnalyticsEvent_PPoGATTDisconnect,
.ppogatt_disconnect = {
.successful_recon... |
nlock:
bt_unlock();
return ret_val;
}
BTErrno gatt_client_op_read(BLECharacteristic characteristic,
GAPLEClient client) {
return prv_read(characteristic, client,
gatt_client_characteristic_get_handle_and_connection,
PebbleBLEGATTClientEventTypeChara... | bt_unlock() | ;
}
|
/*
* Copyright 2024 Google LLC
*
* 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 i... | do_stuff(&test, size) | ;
}
void bind_syscall(char * buf, int size) {
syscall_internal_elevate_privilege();
char * new = buf;
do_stuff(new, size);
}
void malloc_syscall() {
syscall_internal_elevate_privilege();
void *buf = app_malloc(5);
syscall_assert_userspace_buffer(buf, 5);
do_stuff(buf, 5);
}
|
erry_value_t input = cases[i].input;
JERRY_ARGS_MAKE(input);
// Exercise ROCKY_ARG (automatic binding creation, defaults to malloc'd string for char *):
{
char *output = NULL;
ROCKY_ARGS_ASSIGN(ROCKY_ARG(output));
cl_assert_equal_s(output, cases[i].expected_output);
ASSERT_JS_ERROR(... | {
cl_assert_equal_i(output.origin.x.raw_value, cases[i].expected_output.origin.x.raw_value);
cl_assert_equal_i(output.origin.y.raw_value, cases[i].expected_output.origin.y.raw_value);
cl_assert_equal_i(output.size.w.raw_value, cases[i].expected_output.size.w.raw_value);
cl_assert_equal_i(output.... |
for (uint32_t j = 0; j < argc; ++j) {
jerry_release_value(argv[j]);
}
}
}
void test_rocky_api_util_args__gcolor(void) {
const char *type_error_msg =
"TypeError: Argument at index 0 is not a String ('color name' or '#hex') or Number";
const char *invalid_value_msg =
"TypeError: Argumen... |
O_TRIG(90), TO_TRIG(360)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(90),GCornerBottomRight},
.full_quadrants = (GCornersBottom | GCornerTopLeft),
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerTopRight}
}));
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(... | (90 + 45 - 360) | , TO_TRIG(360 + 45 - 360)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(90 + 45),GCornerBottomRight},
.full_quadrants = GCornersLeft,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(45),GCornerTopRight}
}));
// Pair of quadrants
cl_assert_equal_edc(prv_calc_draw_config_... |
0000);
pfs_init(false);
pfs_format(true /* write erase headers */);
load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, FRENCH_FIXTURE_NAME, "lang");
shell_prefs_set_language_english(false);
i18n_set_resource(RESOURCE_ID_STRINGS);
}
void test_i18n__cleanup(void) {
}
extern I18nString *prv_list_find_string(... | (buffer, "Activé") | ;
}
void test_i18n__reset_language(void) {
// allocate some crap, to test that freeing works
const char *first = i18n_get("Music", (void *)0x12345);
const char *second = i18n_get("abcd", (void *)0x12345);
shell_prefs_set_language_english(true);
i18n_set_resource(RESOURCE_ID_STRINGS);
// reinitialize
test... |
{
PBL_LOG(LOG_LEVEL_DEBUG, "i: %d, name: %s, name_out: %s", i, apps[i].bundle_id, app_data_out.bundle_id);
cl_assert_equal_s(apps[i].bundle_id, app_data_out.bundle_id);
} |
}
| |
bled(WeekdaySchedule, false);
active = do_not_disturb_is_active();
cl_assert(active == true);
// Manual && Scheduled && Smart
do_not_disturb_set_manually_enabled(true);
do_not_disturb_set_schedule_enabled(WeekdaySchedule, true);
active = do_not_disturb_is_active();
cl_assert(active == true);
// !Manua... | (WeekdaySchedule, &schedule_1) | ;
do_not_disturb_set_schedule_enabled(WeekdaySchedule, true);
active = do_not_disturb_is_active();
cl_assert(active == true); // Scheduled ON
DoNotDisturbSchedule schedule_2 = {
.from_hour = 5,
.from_minute = 0,
.to_hour = 13,
.to_minute = 0,
};
do_not_disturb_set_schedule(WeekdaySchedule, ... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | {
return false;
} |
int count = last_sector - first_sector + 1;
if (progress_callback) {
progress_callback(0, count, progress_context);
}
FLASH_Unlock();
for (int sector = first_sector; sector <= last_sector; ++sector) {
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |
FLASH_F... |
troller->stop != NULL;
}
if (!is_paused || !can_stop) {
return;
}
prv_end_workout(active_window);
}
static void prv_up_click_handler(ClickRecognizerRef recognizer, void *context) {
WorkoutActiveWindow *active_window = context;
if (active_window->pause_button == BUTTON_ID_UP) {
prv_handle_pause_b... | (&active_window->top_metric_layer, &metric_bounds) | ;
layer_set_update_proc(&active_window->top_metric_layer, prv_static_layer_update_proc);
layer_add_child(&active_window->base_layer, &active_window->top_metric_layer);
} else if (active_window->layout == WorkoutLayout_StaticAndScrollable) {
// Two metrics. 1 big static metric above a smaller scrollable me... |
(count <= 0 || count > 0xFFFF || delay <= 0 || delay > 0xFFFF) {
prompt_send_response("Nope.");
return;
}
struct WasteTimerData data = { count, delay };
uintptr_t data_pack;
memcpy(&data_pack, &data, sizeof data_pack);
if (s_abusive_timer == TIMER_INVALID_ID) {
s_abusive_timer = new_timer_create... | (end_handle) |
};
GAPLEConnection *conn = prv_get_le_connection_and_print_info();
if (conn) {
gatt_client_discovery_discover_range(conn, &range);
}
}
bt_unlock();
}
void command_bt_disc_stop(void) {
bt_lock();
{
GAPLEConnection *conn = prv_get_le_connection_and_print_info();
if (conn) {
... |
{
.major = 5,
.minor = 17,
},
.app_face_bg_color = {0},
.template_id = 0,
};
AppInstallId bg_counter_app_id;
AppInstallId menu_layer_app_id;
AppInstallId big_time_app_id;
// Fakes
////////////////////////////////////
uint32_t time_get_uptime_seconds(void) {
return rtc_get_time();
}
// Tests
/////////... | app_menu_data_source_get_count(&data_source) | ;
cl_assert_equal_i(num_apps, ARRAY_LENGTH(app_default_order));
for (uint16_t i = 0; i < num_apps; i++) {
AppMenuNode *node = app_menu_data_source_get_node_at_index(&data_source, i);
cl_assert_equal_i(node->install_id, app_default_order[i]);
}
app_menu_data_source_deinit(&data_source);
}
static uint1... |
.dest_bitmap, "draw_round_rect_origin_r4_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 1);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw1_... | setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 11) | ;
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 11);
graphics_draw_round_rect(&ctx, &ORIGIN_DR... |
of(void *),
"AppInboxServiceTag should fit inside a void *");
static AppInboxNode *s_app_inbox_head;
static PebbleRecursiveMutex *s_app_inbox_mutex;
////////////////////////////////////////////////////////////////////////////////////////////////////
// Declarations of permitted handlers:
extern void ... | (consumer_info) | ;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
static void prv_lock(void) {
// Using one "global" lock for all app inboxes.
// If needed, we could easily give each app inbox its own mutex, but it seems overkill right now.
mutex_lock_recursive(s_app_inbox... |
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 ... | (start.mday, 8) | ;
cl_assert_equal_i(start.hour, 2);
cl_assert_equal_i(end.ds_label, 'S');
cl_assert_equal_i(end.month, 10);
cl_assert_equal_i(end.mday, 1);
cl_assert_equal_i(end.hour, 2);
}
void test_timezone_database__kazakhstan(void) {
{
const int almaty_region = FIND_REGION("Asia/Almaty");
TimezoneInfo tz_inf... |
cense");
* 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,
* W... | settings_file_exists(file, s_dnd_schedule_keys[WeekdaySchedule].schedule_pref_key,
strlen(s_dnd_schedule_keys[WeekdaySchedule].schedule_pref_key)) | ) {
#define SET_PREF_ALREADY_OPEN(key, value) \
settings_file_set(file, key, strlen(key), value, sizeof(value));
s_dnd_schedule[WeekdaySchedule].schedule = s_legacy_dnd_schedule;
SET_PREF_ALREADY_OPEN(s_dnd_schedule_keys[WeekdaySchedule].schedule_pref_key,
&s_dnd_schedule[WeekdayS... |
License for the specific language governing permissions and
* limitations under the License.
*/
#include "ancs_notifications.h"
#include "ancs_filtering.h"
#include "ancs_item.h"
#include "ancs_phone_call.h"
#include "ancs_notifications_util.h"
#include "nexmo.h"
#include "comm/ble/kernel_le_client/ancs/ancs_types... | pstring_equal_cstring(&app_id->pstr, IOS_REMINDERS_APP_ID) | ) {
return false;
}
// copy out reminder title to a char buffer
char reminder_title_buffer[title->length + 1];
pstring_pstring16_to_string(&title->pstr, reminder_title_buffer);
TimelineItem reminder;
// If we found an existing reminder, replace its dismiss action with ancs negative action
if (remin... |
984},
{ 24, -16, -1088},
// 2 seconds
{ 0, -112, -992},
{ 80, -184, -984},
{ -24, -120, -1064},
{ 96, -160, -1040},
{ 56, -136, -1024},
{ 72, -144, -1016},
{ 80, -168, -1016},
{ 72, -184, -1008},
{ 64, -200, -1008},
{ 56, -192, -1016},
{ 72, -208, -1008},
{ 80, -2... | { 1736, -816, 176},
{ 1456, -248, 8},
{ 1400, -24, -96},
{ 2040, 3872, -1064},
{ 920, 4000, -1296},
{ -384, 3416, -1248},
{ -976, 1344, -32},
{ -936, 344, -208},
{ -1016, -152, -248},
{ -1344, -248, -96},
{ -1056, -152, -96},
{ -1096, 224, 96},
{ -872, 984, -16},
... |
{ -584, -104, -208},
{ -1656, -328, -80},
{ -1680, -312, -320},
{ -1440, -96, 56},
// 10 seconds
{ -1200, 800, 32},
{ -2000, 4000, -1032},
{ -496, 4000, -2480},
{ 440, 2040, -352},
{ 576, 1048, 144},
{ 1664, 280, 144},
{ 1712, -424, 248},
{ 1864, -424, 336},
{ 14... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | {
gpath_init(&path_layer->path, path_info);
const GRect outer_rect = gpath_outer_rect(&path_layer->path);
layer_init(&path_layer->layer, &outer_rect);
path_layer->stroke_color = GColorWhite;
path_layer->fill_color = GColorBlack;
path_layer->layer.update_proc = (LayerUpdateProc)path_layer_update_proc;
} |
void path_layer_deinit(PathLayer *path_layer, const GPathInfo *path_info) {
layer_deinit(&path_layer->layer);
}
void path_layer_set_stroke_color(PathLayer *path_layer, GColor color) {
if (gcolor_equal(color, path_layer->stroke_color)) {
return;
}
path_layer->stroke_color = color;
layer_mark_dirty(&(pat... |
ate);
}
typedef enum {
WordStateStart,
WordStateIdeograph,
WordStateGrowing,
WordStateJoining,
WordStateEnd,
} WordState;
WordState word_state_update(WordState state, Codepoint codepoint) {
WordState new_state = state;
switch (state) {
case WordStateStart:
if (codepoint == NEWLINE_CODEPOINT) ... | {
return fonts_get_font_height(text_box_params->font) + text_box_params->line_spacing_delta;
} |
static int16_t prv_layout_get_line_spacing_delta(GTextLayoutCacheRef layout) {
if (process_manager_compiled_with_legacy2_sdk()) {
return 0;
}
return (layout ? ((TextLayoutExtended *)layout)->line_spacing_delta: 0);
}
////////////////////////////////////////////////////////////
// Iterator advance function... |
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "transform.h"
#include "applib/graphics/gdraw_command_private.h"
#include "applib/graphics/gdraw_command_transforms.h"
#include "appli... | kino_reel_get_duration(data->to_reel) | ;
duration = MAX(duration, to_duration);
}
return duration;
}
static bool prv_elapsed_setter(KinoReel *reel, uint32_t elapsed) {
KinoReelTransformData *data = kino_reel_custom_get_data(reel);
if (data->elapsed == elapsed) {
return false;
}
bool changed = false;
data->elapsed = elapsed;
if (da... |
cate it once though, so it's not the end of the world.
prv_put_notification_action_result(&item->header.id, i18n_get("Dismissed", &i18n_key),
TIMELINE_RESOURCE_RESULT_DISMISSED, ActionResultTypeSuccess);
}
static void prv_perform_ancs_negative_action(const TimelineItem *item,
... | if (ctx->install_id == app_manager_get_current_app_id()) {
WindowStack *window_stack = modal_manager_get_window_stack(ModalPriorityNotification);
window_stack_pop_all(window_stack, true /* animated */);
} |
event_service_client_unsubscribe(&ctx->event_info);
kernel_free(ctx);
}
void timeline_invoke_action(const TimelineItem *item, const TimelineItemAction *action,
const AttributeList *attributes) {
char uuid_buffer[UUID_STRING_BUFFER_LENGTH];
uuid_to_string(&item->header.parent_id, u... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | GRect(x, y, w, h) | );
}
x = left_margin_px;
w = bounds->size.w - left_margin_px - right_margin_px;
GTextAttributes *text_attributes = NULL;
#if PBL_ROUND
// Create a GTextAttributes for the TextLayer. Note that the matching
// graphics_text_attributes_destroy() will not need to be called here, as the ownership
// of text_... |
(BUTTON_ID_SELECT, (ClickHandler) click_handler) | ;
window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler) click_handler);
}
static void init(void) {
window = window_create();
window_set_click_config_provider(window, (ClickConfigProvider) config_provider);
window_stack_push(window, false);
GRect from_rect_a = GRect(0, 0, 60, 60);
GRect to_rect_a =... | |
S OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "progress_ui_app.h"
#include "applib/app.h"
#include "applib/app_timer.h"
#include "applib/graphics/gpath_builder.h"
#include "applib/graphics/graphics.h"
#in... | (data, false /* success */) | ;
return;
} else if (firmware_update_current_status() == FirmwareUpdateStopped) {
prv_handle_finished(data, true /* success */);
return;
}
data->percent_complete = firmware_update_get_percent_progress();
break;
}
}
prv_update_progress_text(data);
progress_laye... |
pertyAnimation *prop_h;
int16_t value = 0;
int16_t start_value = 0, end_value = 100;
const int duration = 200;
const int delay = 25;
const AnimationHandlers handlers = {
.started = prv_started_handler,
.stopped = prv_stopped_handler
};
static const PropertyAnimationImplementation implementation ... | property_animation_create(&implementation, &value, &start_value, &end_value) | ;
Animation *h = property_animation_get_animation(prop_h);
void *context = &value;
animation_set_handlers(h, handlers, context);
animation_set_duration(h, duration);
animation_set_delay(h, delay);
animation_set_auto_destroy(h, false);
prv_clear_handler_histories();
animation_schedule(h);
int max_lo... |
,
jerry_size_t buffer_size) {
return jerry_object_to_string_to_utf8_char_buffer(object,
buffer_p,
buffer_size);
}
jerry_value_t jerry_get_object_keys(const jerry_... | {
if (jerry_value_has_error_flag(value)) {
return TYPE_ERROR_FLAG;
}
return (jerry_value_t)EM_ASM_INT({
return __jerryRefs.ref(String(__jerryRefs.get($0)));
}, value);
} |
int jerry_obj_refcount(jerry_value_t o) {
return EM_ASM_INT({
try {
return __jerryRefs.getRefCount($0);
} catch (e) {
return 0;
}
}, o);
}
////////////////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////... |
n(test_player);
cl_assert_equal_i(animation_is_scheduled(animation), false);
animation_schedule(animation);
animation_set_elapsed(animation, 20);
animation_set_duration(animation, 300);
prv_play_animation_update(animation, 0); // intentionally bad value
cl_assert_equal_i(kino_reel_get_elapsed(test_reel),... | (test_reel) | , 300 - 20);
}
void test_kino_player__finite_animation_infinite_reel_reverse(void) {
// Choose duration and elapsed to have clean division for
// ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number
test_reel_data->duration_ms = ANIMATION_DURATION_INFINITE;
kino_player_play(test_player);
animation_s... |
"Updated address to "BT_DEVICE_ADDRESS_FMT". Updated IRK: %c",
BT_DEVICE_ADDRESS_XPLODE(connection->device.address), e->is_resolved ? 'Y' : 'N');
} else if (e->is_resolved) {
PBL_LOG(LOG_LEVEL_INFO, "Updated IRK: %c", e->is_resolved ? 'Y' : 'N');
}
const SMIdentityResolvin... | {
GAPLEConnectionIntent *next = (GAPLEConnectionIntent *) intent->node.next;
if (prv_intent_matches_connection(intent, connection)) {
found_match = true;
if (intent->is_bonding_based) {
// Update connection address:
intent->device = event->peer_address;
... | |
//! get it into a working state
static void prv_flash_start_cmd(void) {
GPIO_ResetBits(FLASH_GPIO, FLASH_PIN_SCS);
}
static void prv_flash_end_cmd(void) {
GPIO_SetBits(FLASH_GPIO, FLASH_PIN_SCS);
// 50ns required between SCS going high and low again, so just delay here to be safe
delay_us(1);
}
static uint8... | prv_flash_end_cmd() | ;
}
uint32_t cd_flash_write_bytes(const void* buffer_ptr, uint32_t start_addr, uint32_t buffer_size) {
CD_ASSERTN((start_addr + buffer_size <= CORE_DUMP_FLASH_END) &&
(int)start_addr >= CORE_DUMP_FLASH_START);
const uint8_t* buffer = buffer_ptr;
const uint32_t total_bytes = buffer_size;
uint32_t first_p... |
, 35),
.text_inset_single = -1,
.text_inset_multi = -3,
.right_text_inset_with_icon = 4,
};
static const OptionMenuStyle * const s_styles[NumPreferredContentSizes] = {
[PreferredContentSizeSmall] = &s_style_medium,
[PreferredContentSizeMedium] = &s_style_medium,
[PreferredContentSizeLarge] = &s_style_large... | prv_get_style() | ;
const int32_t left_text_inset = menu_cell_basic_horizontal_inset();
const int32_t right_text_inset = option_menu->icons_enabled ? style->right_text_inset_with_icon :
left_text_inset;
remaining_rect = grect_inset(remaining_rect, GEdgeInsets(style->t... |
/*
* Copyright 2024 Google LLC
*
* 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 i... | (draw_command) | ;
memset(data->processed_draw_command, 0, size);
memcpy(data->processed_draw_command, draw_command, size);
if (data->processor->command) {
data->processor->command(data->processor, data->processed_draw_command, size, data->list,
draw_command);
}
gdraw_command_draw(data->ctx, ... |
t_set_text_color(&ctx, GColorBlack);
graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NULL,
GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL);
cl_check(framebuffer_is_empty("draw_text_null_null", fb, GColorWhite));
}
void test_graphics_draw_text_8bit__color(void) {
GContext ctx;... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_data_row_offsets.8bit.pbi")) | ;
}
|
/*
* Copyright 2024 Google LLC
*
* 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 i... | (dstbuf, "There are 04 lights, -4") | ;
// Space padded minimum character output
snprintf(dstbuf, 256, "There are %2d lights, %2d", 4, -4);
cl_assert_equal_s(dstbuf, "There are 4 lights, -4");
// Left-align, Space padded minimum character output
snprintf(dstbuf, 256, "There are %-2d lights, %-2d", 4, -4);
cl_assert_equal_s(dstbuf, "There are... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.