From 55e4108a35fb1d6384f8a1167111adfc2cb2c909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezgi=20=C3=87i=C3=A7ek?= Date: Thu, 11 Mar 2021 06:23:06 -0800 Subject: [PATCH] [cost][differential] Add FP test for blocks Summary: We shouldn't report a complexity increase here because `existing_block_here` is a removed function (that doesn't exist in current version)! Reviewed By: skcho Differential Revision: D26947439 fbshipit-source-id: 6620804be --- .../costs_summary.json.exp | 2 +- .../differential_of_costs_report_objc/introduced.exp | 1 + .../src/DiffBlock.previous.m | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/infer/tests/build_systems/differential_of_costs_report_objc/costs_summary.json.exp b/infer/tests/build_systems/differential_of_costs_report_objc/costs_summary.json.exp index 6aa1a7abe..918aab152 100644 --- a/infer/tests/build_systems/differential_of_costs_report_objc/costs_summary.json.exp +++ b/infer/tests/build_systems/differential_of_costs_report_objc/costs_summary.json.exp @@ -1 +1 @@ -{"top":{"current":0,"previous":0},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":20,"previous":15},{"degree":100,"current":5,"previous":1},{"degree":200,"current":1,"previous":0}]} \ No newline at end of file +{"top":{"current":0,"previous":0},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":20,"previous":23},{"degree":100,"current":5,"previous":1},{"degree":200,"current":1,"previous":0}]} \ No newline at end of file diff --git a/infer/tests/build_systems/differential_of_costs_report_objc/introduced.exp b/infer/tests/build_systems/differential_of_costs_report_objc/introduced.exp index d71ef366e..cd88bf1fa 100644 --- a/infer/tests/build_systems/differential_of_costs_report_objc/introduced.exp +++ b/infer/tests/build_systems/differential_of_costs_report_objc/introduced.exp @@ -1,2 +1,3 @@ +EXECUTION_TIME_COMPLEXITY_INCREASE, no_bucket, src/DiffBlock.m, CallBlocks.take_two_blocks:block1:block2:[objc_blockHandler.create_block_here:array:call:_2^objc_blockHandler.create_block_here:array:call:_3], 0, [Previous Cost of take_two_blocks:block1:block2: is 6 (degree is 0),Updated Cost of take_two_blocks:block1:block2: is 22 + 9 ⋅ (array[create_block_here:array:call:]->elements.length + 1) (degree is 1),{array[create_block_here:array:call:]->elements.length + 1},Call to objc_blockHandler.create_block_here:array:call:_2,Loop] EXECUTION_TIME_COMPLEXITY_INCREASE, no_bucket, src/DiffBlock.m, Handler.func_linear:, 0, [Previous Cost of func_linear: is 4 + 5 ⋅ (array->elements.length + 1) (degree is 1),{array->elements.length + 1},Loop,Updated Cost of func_linear: is 4 + 3 ⋅ array->elements.length × (array->elements.length + 1) + 8 ⋅ (array->elements.length + 1) + 3 ⋅ (array->elements.length + 1) × (array->elements.length + 1) (degree is 2),{array->elements.length + 1},Loop,{array->elements.length},Call to Handler.loop_linear:,Loop] EXECUTION_TIME_COMPLEXITY_INCREASE, no_bucket, src/DiffBlock.m, objc_blockHandler.func_linear_1, 0, [Previous Cost of objc_blockHandler.func_linear_1 is 21 (degree is 0),Updated Cost of objc_blockHandler.func_linear_1 is 23 + 3 ⋅ str.length + 3 ⋅ (str.length + 1) (degree is 1),{str.length},Loop] diff --git a/infer/tests/build_systems/differential_of_costs_report_objc/src/DiffBlock.previous.m b/infer/tests/build_systems/differential_of_costs_report_objc/src/DiffBlock.previous.m index c4ec0c836..9ecbca3a1 100644 --- a/infer/tests/build_systems/differential_of_costs_report_objc/src/DiffBlock.previous.m +++ b/infer/tests/build_systems/differential_of_costs_report_objc/src/DiffBlock.previous.m @@ -46,6 +46,15 @@ } } +- (void)existing_block_here:(NSInteger*)n + array:(NSArray*)array + call:(CallBlocks*)call { + [call take_two_blocks:n + block1:^(NSInteger* n) { + } + block2:^(NSInteger* n){ + }]; +} @end int main() { return 0; }