Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

False-positive diff change when comparing a large hash #100

Closed
khiav223577 opened this issue Oct 8, 2020 · 2 comments
Closed

False-positive diff change when comparing a large hash #100

khiav223577 opened this issue Oct 8, 2020 · 2 comments

Comments

@khiav223577
Copy link

There should not have "inspection_doctor" in diff in that they are the same both in expected and in actual.

See the screenshots:
螢幕擷取畫面 2020-10-08 152315
螢幕擷取畫面 2020-10-08 152312

This is the test cases:

it do
  expect_response_header(:ok)
  expect(response_data).to eq(
    "items_count" => 2,
    "max_page"    => 1,
    "elements"    => [
      {
        "id"                        => target_specimens[0].id,
        "kind"                      => "lithium_heparin",
        "number"                    => "107-HEP-0001",
        "patient_medical_record_no" => "MED_0077",
        "patient_name"              => nil,
        "patient_id_card"           => nil,
        "patient_gender"            => nil,
        "patient_birthday"          => "1991-03-12",
        "patient_hospital"          => nil,
        "family_hospital"           => nil,
        "family_medical_record_no"  => nil,
        "family_title"              => nil,
        "inspect_date"              => nil,
        "submit_date"               => nil,
        "receive_date"              => "2017-06-01",
        "inspection_unit"           => nil,
        "inspection_doctor"         => nil,
        "description"               => nil,
        "disease"                   => nil,
        "REQ"                       => nil,
        "comments"                  => nil,
        "discarded_at"              => "2018-07-03 08:12:54"
      },
      {
        "id"                          => target_specimens[1].id,
        "kind"                        => "urine",
        "number"                      => "107-URN-0001",
        "patient_medical_record_no"   => "MED_3527",
        "patient_name"                => nil,
        "patient_id_card"             => nil,
        "patient_gender"              => nil,
        "patient_birthday"            => "1993-07-18",
        "patient_hospital"            => nil,
        "family_hospital"             => nil,
        "family_medical_record_no"    => nil,
        "family_title"                => nil,
        "inspect_date"                => nil,
        "submit_date"                 => nil,
        "receive_date"                => "2017-06-08",
        "inspection_unit"             => nil,
        "inspection_doctor"           => "unknown",
        # "inspection_doctor_unmatched" => true,
        "description"                 => nil,
        "disease"                     => nil,
        "REQ"                         => nil,
        "comments"                    => nil,
        "discarded_at"                => "2018-07-03 08:12:54"
      }
    ]
  )
end

Environment

super_diff (0.5.2)
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]
Rails 5.2.4
@mcmire
Copy link
Owner

mcmire commented Oct 12, 2020

Thanks for the report, that's weird for sure. I'll check it out shortly!

@hedgesky
Copy link

I've experienced a similar issue. Downgrading to 0.4.2 solved it

groyoh added a commit to happydemics/super_diff that referenced this issue May 5, 2021
When a key in the `actual` results in a noop and its key index in the `expected`
is less than its index in the `actual`, the diff would display a `delete` for
this key along with a noop. For instance, in the diff below we have
`-   profile_background_tile: false,` and `    profile_background_tile: false`.

```
Differing hashes.

Expected: { created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, geo_enabled: false, verified: true, media_count: 51044, statuses_count: 273860, contributors_enabled: false, profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_background_color: "FFF1E0", profile_background_tile: false, profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", listed_count: 37009, profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592" }
  Actual: { listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592", profile_background_tile: false }

Diff:

  {
    listed_count: 37009,
    created_at: "Tue Jan 13 19:28:24 +0000 2009",
    favourites_count: 38,
-   geo_enabled: false,
-   verified: true,
+   utc_offset: nil,
    statuses_count: 273860,
    media_count: 51044,
    contributors_enabled: false,
+   is_translator: false,
+   is_translation_enabled: false,
    profile_background_color: "FFF1E0",
    profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",
-   profile_background_tile: false,
-   profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
    profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",
    profile_background_tile: false
  }
```
@mcmire mcmire closed this as completed in 5872288 May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants