public boolean checkRefs() {
        List<Map<String, Object>> failedRefs = new ArrayList<>();
        List<Map<String, Object>> extraRefs = new ArrayList<>();
        String json = _.readFile(expecteRefsFile);
        if (json == null) {
            _.msg("Expected refs not found in: " + expecteRefsFile +
                    "Please run Test with -exp to generate");
            return false;
        }
        List<Map<String, Object>> expectedRefs = gson.fromJson(json, List.class);
        for (Map<String, Object> r : expectedRefs) {
            Map<String, Object> refMap = (Map<String, Object>) r.get("ref");
            Dummy dummy = makeDummy(refMap);

            List<Map<String, Object>> dests = (List<Map<String, Object>>) r.get("dests");
            List<Binding> actualDests = analyzer.references.get(dummy);
            List<Map<String, Object>> failedDests = new ArrayList<>();
            List<Map<String, Object>> extraDests = new ArrayList<>();

            for (Map<String, Object> d : dests) {
                // names are ignored, they are only for human readers
                String file = _.projAbsPath((String) d.get("file"));
                int start = (int) Math.floor((double) d.get("start"));
                int end = (int) Math.floor((double) d.get("end"));

                if (actualDests == null ||
                        !checkBindingExist(actualDests, file, start, end))
                {
                    failedDests.add(d);
                }
            }

            if (actualDests != null && !actualDests.isEmpty()) {
                for (Binding b : actualDests) {
                    String destFile = b.file;
                    if (destFile != null && destFile.startsWith(Analyzer.self.projectDir)) {
                        destFile = _.projRelPath(destFile);
                        Map<String, Object> d1 = new LinkedHashMap<>();
                        d1.put("file", destFile);
                        d1.put("start", b.start);
                        d1.put("end", b.end);
                        extraDests.add(d1);
                    }
                }
            }

            // record the ref & failed dests if any
            if (!failedDests.isEmpty()) {
                Map<String, Object> failedRef = new LinkedHashMap<>();
                failedRef.put("ref", refMap);
                failedRef.put("dests", failedDests);
                failedRefs.add(failedRef);
            }

            if (!extraDests.isEmpty()) {
                Map<String, Object> extraRef = new LinkedHashMap<>();
                extraRef.put("ref", refMap);
                extraRef.put("dests", extraDests);
                extraRefs.add(extraRef);
            }
        }

        if (!failedRefs.isEmpty()) {
            String failedJson = gson.toJson(failedRefs);
            _.testmsg("failed to find refs: " + failedJson);
            _.writeFile(failedRefsFile, failedJson);
        }

        if (!extraRefs.isEmpty()) {
            String extraJson = gson.toJson(extraRefs);
            _.testmsg("found extra refs: " + extraJson);
            _.writeFile(extraRefsFile, extraJson);
        }

        return failedRefs.isEmpty() && extraRefs.isEmpty();
    }