mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
feat: Add crc32 filter (#5062)
* feat: Add crc32 filter Compute CRC32 checksum of a string and return its hex representation. Can be use to create short checksums. Signed-off-by: Julien Riou <julien@riou.xyz> * Update license lines * Improve string check of a crc32 value Signed-off-by: Julien Riou <julien@riou.xyz> Signed-off-by: Julien Riou <julien@riou.xyz> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
2149056595
commit
8e9ec610c3
3 changed files with 83 additions and 0 deletions
17
tests/unit/plugins/filter/test_crc32.py
Normal file
17
tests/unit/plugins/filter/test_crc32.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2022, Julien Riou <julien@riou.xyz>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat import unittest
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible_collections.community.general.plugins.filter.crc32 import crc32s
|
||||
|
||||
|
||||
class TestFilterCrc32(unittest.TestCase):
|
||||
|
||||
def test_checksum(self):
|
||||
self.assertEqual(crc32s('test'), 'd87f7e0c')
|
Loading…
Add table
Add a link
Reference in a new issue