Skip to content

Commit

Permalink
Merge pull request #316 from zaqbez39me/test/nomr
Browse files Browse the repository at this point in the history
Added test for NOMR mertic
  • Loading branch information
yegor256 authored May 18, 2024
2 parents b7b28ac + eb9b726 commit 0a839ae
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/metrics/test-ast.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# shellcheck disable=SC2317
# The MIT License (MIT)
#
# Copyright (c) 2021-2024 Yegor Bugayenko
Expand Down Expand Up @@ -61,6 +62,8 @@ stdout=$2
grep "NOMPMx 0 " "${temp}/stdout"
grep "NOSMPMx 0 " "${temp}/stdout"
grep "NOM 0 " "${temp}/stdout"
# Uncomment it when the NOMR is implemented
# grep "NOMR 0 " "${temp}/stdout"
grep "NOP 0 " "${temp}/stdout"
grep "NULLs 0 " "${temp}/stdout"
grep "DOER 0.5 " "${temp}/stdout"
Expand Down Expand Up @@ -93,3 +96,20 @@ echo "👍🏻 Correctly counted NULL references"
fi
} > "${stdout}" 2>&1
echo "👍🏻 Usage works correctly"


# TODO: #316 Remove this 'exit 0' below, uncomment the 'grep NOMR' above in first test and remove `shellcheck disable=SC2317` on the top when the NOMR is implemented
exit 0
{
java="${temp}/Hello.java"
echo "class Hello {
@Override
String x() { return null; }
String y() { return \"null\"; }
}" > "${java}"
"${LOCAL}/metrics/ast.py" "${java}" "${temp}/stdout"
cat "${temp}/stdout"
grep "NOM 2 " "${temp}/stdout"
grep "NOMR 0.5 " "${temp}/stdout"
} > "${stdout}" 2>&1
echo "👍🏻 Correctly calculated NOM and NOMR"

0 comments on commit 0a839ae

Please sign in to comment.