test_census_diff_01.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. // Test diffing census reports of breakdown by "internalType".
  4. const BREAKDOWN = {
  5. by: "internalType",
  6. then: { by: "count", count: true, bytes: true }
  7. };
  8. const REPORT1 = {
  9. "JSObject": {
  10. "count": 10,
  11. "bytes": 100,
  12. },
  13. "js::Shape": {
  14. "count": 50,
  15. "bytes": 500,
  16. },
  17. "JSString": {
  18. "count": 0,
  19. "bytes": 0,
  20. },
  21. "js::LazyScript": {
  22. "count": 1,
  23. "bytes": 10,
  24. },
  25. };
  26. const REPORT2 = {
  27. "JSObject": {
  28. "count": 11,
  29. "bytes": 110,
  30. },
  31. "js::Shape": {
  32. "count": 51,
  33. "bytes": 510,
  34. },
  35. "JSString": {
  36. "count": 1,
  37. "bytes": 1,
  38. },
  39. "js::BaseShape": {
  40. "count": 1,
  41. "bytes": 42,
  42. },
  43. };
  44. const EXPECTED = {
  45. "JSObject": {
  46. "count": 1,
  47. "bytes": 10,
  48. },
  49. "js::Shape": {
  50. "count": 1,
  51. "bytes": 10,
  52. },
  53. "JSString": {
  54. "count": 1,
  55. "bytes": 1,
  56. },
  57. "js::LazyScript": {
  58. "count": -1,
  59. "bytes": -10,
  60. },
  61. "js::BaseShape": {
  62. "count": 1,
  63. "bytes": 42,
  64. },
  65. };
  66. function run_test() {
  67. assertDiff(BREAKDOWN, REPORT1, REPORT2, EXPECTED);
  68. }